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






DBMS_LOB.ERASE

 

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

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