I don't quite get the point of the dbms_lob.createtemporary() function. How is:
DECLARE myclob CLOB; BEGIN myclob := 'foo'; END;
any different from:
DECLARE myclob CLOB; BEGIN dbms_lob.createtemporary( myclob, TRUE ); myclob := 'foo'; dbms_lob.freetemporary( myclob ); END;
I'm assuming the actions in between the create and free calls make it relevant, but I'm just not clear on how.
n createtemporary: The procedure createtemporary creates a temporary CLOB or BLOB and its corresponding index in the user default temporary tablespace. n instr: Used to return the matching position of the nth occurrence of the pattern in the LOB. n getlength: Used to get the length of specified LOB.
The DBMS_LOB package provides subprograms to operate on BLOBs, CLOBs, and NCLOBs. You can use DBMS_LOB to access and manipulate specific parts of LOBs or complete LOBs. You can also refer to "Large objects (LOBs)" in Oracle TimesTen In-Memory Database PL/SQL Developer's Guide.
Overview. DBMS_LOB can read and modify BLOBs , CLOBs , and NCLOBs ; it provides read-only operations for BFILEs . The bulk of the LOB operations are provided by this package.
For a clob , substr returns a substring as varchar2 , with a given amount of characters, starting at a given position (offset). For a blob , it returns the bytes indicated bytes as a raw .
In earlier times you were always forced to use DBMS_LOB package. Then in Oracle 10g a feature called "SQL semantics for LOB" was introduced and now you can use the simplified syntax.
In CREATETEMPORARY
you can specify the duration of the LOB in SQL semantic you cannot.
In your case the LOB is freed in the same way, i.e. when you leave the scope (i.e. the PL/SQL block) where the LOB is declared, then it is freed.
When you use FREETEMPORARY
then the temporary segment in tablespace is released, when you call myclob := NULL;
it will be kept.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With