DBMS_LOB.READ : dbms_lob « System Packages « Oracle PL / SQL






DBMS_LOB.READ

 

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.

   
  








Related examples in the same category

1.Use dbms_lob.getchunksize to get the clob column size
2.Call dbms_lob.write to write value to clob type value
3.Use dbms_lob.writeappend to append value to clob type value
4.Use dbms_lob.compare to compare
5.Use dbms_lob.compare to compare clob type value with offset
6.Use dbms_lob for load clob data from file
7.This block demonstrates the use of DBMS_LOB.COPY.
8.This block demonstrates DBMS_LOB.GETLENGTH.
9.DBMS_LOB.SUBSTR: Select the first 50 characters of clob_col, and the first 25 bytes of blob_col, for each row.
10.Use DBMS_LOB.GETLENGTH to get the length of a clob type variable
11.DBMS_LOB.CREATETEMPORARY
12.DBMS_LOB.ERASE
13.DBMS_LOB.FREETEMPORARY
14.DBMS_LOB.ISTEMPORARY
15.DBMS_LOB.WRITE
16.This script tests the DBMS_LOB.LOADFROMFILE procedure