By now, we have gathered enough understanding on the LOB data types. We will now see the handling of LOB data in PL/SQL. For illustration purposes, we will use the EMP_LOB_DEMO
table, which has been created earlier.
As we learned earlier the LOB column in the table contains only the pointer (LOB locator), while the actual data is stored in the LOB segment. The LOB segment is a different storage area in the same or different tablespace.
For initialization of a LOB data type variable or column, Oracle provides two built-in constructor methods namely, EMPTY_CLOB()
and EMPTY_BLOB()
. These functions are supported in SQL as well as PL/SQL. The functions assign a default LOB locator to the CLOB and BLOB data type columns or variables. Let us check it out.
The PL/SQL block, shown in the following code snippet, declares a CLOB and BLOB variable and initializes them in the declarative section. However, the initialization...