Lesson 9 | Deleting LOB data using PL/SQL |
Objective | Use DBMS_LOB to delete LOB data. |
DELETE
, or DROP TABLE
, TRUNCATE
TABLE
, or DROP TABLESPACE
LOB
column have
their own distinct LOB
locators and their own copies of the LOB
values irrespective of whether these
LOB
values are the same. This means that deleting one row has no effect on the data or LOB
locator within another row, even if one LOB was originally copied from another row.DELETE
statements include:
DELETE FROM Customer_photo_obj_table WHERE customer_id = 10; DROP TABLE Customer_photo_obj_table; TRUNCATE TABLE Customer_photo_obj_table;
ERASE()
procedure allows you to erase a part of or the entire LOB, depending on the amount of data and offset parameters passed to the procedure. The actual number of bytes or characters erased can differ from the number specified in the AMOUNT
parameter if the end of the LOB
parameter is reached. Erased characters are replaced with
zero-byte fillers [1] for BLOBs and spaces for CLOBs.EMPTY_CLOB()
and EMPTY_BLOB()
functions. In this evaluative simulation, we will update the LOB value with an actual file using the DBMS_LOB.LOADFROMFILE
function:
DBMS_LOB.ERASE
function to erase a part of the LOB data. This function requires three parameters: the LOB, the number of bytes to be erased, and the starting
point for erasing the data.