This block demonstrates DBMS_LOB.GETLENGTH.
SQL>
SQL>
SQL> CREATE TABLE lobdemo (
2 key NUMBER,
3 clob_col CLOB,
4 blob_col BLOB);
Table created.
SQL>
SQL>
SQL> set serveroutput on format wrapped
SQL> DECLARE
2 CURSOR c_LOBQuery IS
3 SELECT key, clob_col, blob_col
4 FROM lobdemo
5 WHERE key IN (0, 100, 101, 102, 103, 1000, 1001, 1002)
6 ORDER BY key;
7 BEGIN
8 FOR v_Rec IN c_LOBQuery LOOP
9 DBMS_OUTPUT.PUT_LINE('Key: ' || v_Rec.key);
10 DBMS_OUTPUT.PUT_LINE(' Length of CLOB: ' ||
11 DBMS_LOB.GETLENGTH(v_Rec.clob_col));
12 DBMS_OUTPUT.PUT_LINE(' Length of BLOB: ' ||
13 DBMS_LOB.GETLENGTH(v_Rec.blob_col));
14 END LOOP;
15 END;
16 /
PL/SQL procedure successfully completed.
SQL>
SQL> drop table lobdemo;
Table dropped.
SQL>
SQL>
Related examples in the same category