Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the point of dbms_lob.createtemporary()?

Tags:

oracle

plsql

lob

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.

like image 233
eaolson Avatar asked Jan 19 '14 16:01

eaolson


People also ask

What does DBMS_LOB Createtemporary do?

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.

What is the use of DBMS_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.

What is DBMS_LOB read?

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.

What is DBMS_LOB Substr in Oracle?

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 .


1 Answers

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.

like image 130
Wernfried Domscheit Avatar answered Sep 28 '22 06:09

Wernfried Domscheit