Print out the length of the CLOBs previously INSERTed : Clob « Data Type « Oracle PL / SQL






Print out the length of the CLOBs previously INSERTed

  
SQL>
SQL> CREATE TABLE lobdemo (
  2    key NUMBER,
  3    clob_col CLOB,
  4    blob_col BLOB);

Table created.

SQL>
SQL>
SQL> DECLARE
  2    v_CLOB CLOB;
  3    v_Key lobdemo.key%TYPE;
  4    CURSOR c_SomeLOBs IS
  5      SELECT key, clob_col
  6      FROM lobdemo
  7      WHERE key BETWEEN 50 and 61;
  8  BEGIN
  9    OPEN c_SomeLOBs;
 10    LOOP
 11      FETCH c_SomeLOBs INTO v_Key, v_CLOB;
 12      EXIT WHEN c_SomeLOBs%NOTFOUND;
 13
 14      DBMS_OUTPUT.PUT_LINE(
 15        'Length of CLOB at key ' || v_Key || ' is: ' ||
 16        DBMS_LOB.GETLENGTH(v_CLOB));
 17    END LOOP;
 18    CLOSE c_SomeLOBs;
 19  END;
 20  /

PL/SQL procedure successfully completed.

SQL>
SQL>
SQL> drop table lobdemo;

Table dropped.

SQL>

   
  








Related examples in the same category

1.clob data type
2.Use clob type in PL/SQL
3.Use dbms_lob.erase to remove value from clob type value
4.Use dbms_lob.fileopen to open bfile
5.Creating an Internal LOB Table
6.Copying Internal LOBs
7.Appending and Writing to LOBs
8.DBMS_LOB package.
9.Compare clob data
10.Compare two clobs
11.Append data to clob
12.Assign string value to clob type variable
13.Clob type column
14.Copy clob data
15.In() function with clob data
16.Initialize clob
17.Read clob type data, DBMS_LOB.READ
18.Use between ... and with clob data
19.Use clob to store xml data
20.clob type data as string
21.erase clob data
22.use like operator with clob type data