This one caught me out – I was racing around looking for bugs, or parameter files, or hidden settings that stopped SECUREFILE lobs from being created. Here was my incredibly simple test case – create a securefile LOB, and then make sure it’s a securefile.
SQL> create table t1 ( b blob ) lob ( b ) store as securfile;
Table created.
SQL> select securefile
2 from user_lobs
3 where table_name = 'T1';
SEC
---
NO
That had me bamboozled, but it is a trivial explanation. Notice that I did not spell “SECUREFILE” correctly. As a result, the syntax is interpreted as being the name of the LOB segment in the data dictionary, rather than the specification of how the LOB should be stored.
SQL> select segment_name
2 from user_lobs
3 where table_name = 'T1';
SEGMENT_NAME
------------------------------
SECURFILE
All it takes is the correct “e” in “securefile” and normal service was resumed
SQL> drop table t1 purge;
Table dropped.
SQL> create table t1 ( b blob ) lob ( b ) store as securefile;
Table created.
SQL> select securefile
2 from user_lobs
3 where table_name = 'T1';
SEC
---
YES
So why blog about it such a silly mistake ? Because this is a common issue with all of us as developers. We see something unusual and our first assumption is that it must be some fundamental flaw in the product we’re using. That mindset has been around as long computer programming has existed, but but 20 years ago, it wasn’t so easy to make a fool of yourself by bleating about it on social media . I remember when I first started programming, one of my mentors told me: “Remember, the COBOL compiler is not broken”, and of course, we can insert any programming language into that sentence. So before you jump on to Twitter … just take a moment to re-check that script, or get a colleague to give it a “once over”. You’ll either save yourself some embarrassment, or you add additional rigour to your test case – it’s win-win.
Would it have saved the day if that command without the “e” had resulted in an syntax error, just like all other commands?
Well – it is not a syntax error – it is just naming the lob segment