SQL> CREATE TABLE myTable (
2 id INTEGER PRIMARY KEY,
3 clobData CLOB NOT NULL
4 );
Table created.
SQL>
SQL> CREATE OR REPLACE PROCEDURE temporary_lob_example IS
2 clobVariable CLOB;
3 amount_var INTEGER := 19;
4 offsetPos INTEGER := 1;
5 charVariable VARCHAR2(19) := 'AAAA';
6 BEGIN
7 DBMS_LOB.CREATETEMPORARY(clobVariable, TRUE);
8 DBMS_LOB.WRITE(clobVariable, amount_var, offsetPos, charVariable);
9
10 IF (DBMS_LOB.ISTEMPORARY(clobVariable) = 1) THEN
11 DBMS_OUTPUT.PUT_LINE('clobVariable is temporary');
12 END IF;
13
14 DBMS_LOB.READ(clobVariable, amount_var, offsetPos, charVariable);
15 DBMS_OUTPUT.PUT_LINE('charVariable = ' || charVariable);
16
17 DBMS_LOB.FREETEMPORARY(clobVariable);
18 END temporary_lob_example;
19 /
Procedure created.
SQL>
SQL>
SQL> drop table myTable;
Table dropped.