Pl/sql Procedure: Data reading of Clob field types in Oracle 11g
the database column of the LOB type stores only the locator, which points to the storage location of the large object.
manipulate LOB data with the Dbms_lob package. When reading data with an Oracle field type of CLOB column, only part of the following figure can be read: a
full read of the data Pl/sql procedure for an Oracle field type of CLOB column
:
DECLARE
/* Declaration Pl/sql in the program block in the variable Info_var, the user holds the query to the Info column of the data, its type must be the same as the field type in the table/
info_var clob;
--Query data length
amount integer;
--Offset, query start position
offset integer;
--The byte to be printed, the storage variable
info_output varchar2 (1000);
Begin
--queries the field information to be printed and assigns it to Info_var
Select info into Info_var from T_clob where id = 1;
--Inquiry 100 length
amount: =100;
--From the first start
offset: =1;
--Using DBMS_LOB package to read Data
dbms_lob.read (Info_var,amount,offset,info_var);
--print read and obtain data with Dbms_lob package Info_var
dbms_output.put_line (info_var);
End;
/
command: SET serveroutput on window display data