Use DBMS_LOB.GETLENGTH to get the length of a clob type variable : dbms_lob « System Packages « Oracle PL / SQL






Use DBMS_LOB.GETLENGTH to get the length of a clob type variable

 
SQL> CREATE TABLE nmyTable (
  2    id INTEGER PRIMARY KEY,
  3    nclobData NCLOB
  4  );

Table created.

SQL> CREATE TABLE myTable (
  2    id INTEGER PRIMARY KEY,
  3    clobData CLOB
  4  );

Table created.

SQL>
SQL> CREATE OR REPLACE TRIGGER before_myTable_update
  2  BEFORE UPDATE
  3  ON myTable
  4  FOR EACH ROW
  5  BEGIN
  6    DBMS_OUTPUT.PUT_LINE('myTable changed');
  7    DBMS_OUTPUT.PUT_LINE('Length = ' || DBMS_LOB.GETLENGTH(:new.clobData));
  8  END before_myTable_update;
  9  /

Trigger created.

SQL>
SQL> drop table myTable;

Table dropped.

SQL> drop table nmyTable;

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.DBMS_LOB.CREATETEMPORARY
11.DBMS_LOB.ERASE
12.DBMS_LOB.FREETEMPORARY
13.DBMS_LOB.ISTEMPORARY
14.DBMS_LOB.READ
15.DBMS_LOB.WRITE
16.This script tests the DBMS_LOB.LOADFROMFILE procedure