erase clob data
SQL> CREATE TABLE myTable (
2 id INTEGER PRIMARY KEY,
3 clobData CLOB NOT NULL
4 );
Table created.
SQL>
SQL>
SQL> CREATE OR REPLACE PROCEDURE readClob(id_par IN INTEGER) IS
2 clobVariable CLOB;
3 charVariable VARCHAR2(50);
4 offsetPos INTEGER := 1;
5 amount_var INTEGER := 50;
6 BEGIN
7 initClob(clobVariable, id_par);
8 DBMS_LOB.READ(clobVariable, amount_var, offsetPos, charVariable);
9 DBMS_OUTPUT.PUT_LINE('charVariable = ' || charVariable);
10 DBMS_OUTPUT.PUT_LINE('amount_var = ' || amount_var);
11 END readClob;
12 /
Procedure created.
SQL>
SQL>
SQL> CREATE OR REPLACE PROCEDURE erase_example IS
2 clobVariable CLOB;
3 offsetPos INTEGER := 2;
4 amount_var INTEGER := 5;
5 BEGIN
6 SELECT clobData INTO clobVariable FROM myTable WHERE id = 1 FOR UPDATE;
7
8 readClob(1);
9 DBMS_LOB.ERASE(clobVariable, amount_var, offsetPos);
10 readClob(1);
11
12 END erase_example;
13 /
Procedure created.
SQL>
SQL> drop table myTable;
Table dropped.
Related examples in the same category