Today, I found that there is a clob field in the Oracle8i library. I want to change it into varchar2. The key issue has become how to keep data. I checked Oracle9i's document. There is a to_char method, I am happy, but I don't try it. It is good to support 9i support, 8i does not support, depressed.
Seeking help from friends in the database, informing you to use two ways:
1 dBMS_LOB.READ
Lob_loc in Clob Character Set any_cs,
Amount In Out NoCopy Binary_INTEGER,
OFFSET in INTEGER,
Buffer out varcha2 character set lob_loc% charset);
22-46 Supplied Pl / SQL Packages and Types Reference
Lob_loc locator for the lob to be read.
File_loc the file locator for the lob to be exampled.
Summary of dbms_lob subsprograms
Amount Number of Bytes (for blobs) or characters (for clobs) to read, or
Number That Were Read.
Offset offset in bytes (for blobs) or characters (for clobs) from the start of
The LOB (Origin: 1).
Buffer Output Buffer for the Read Operation
2
DBMS_LOB.SUBSTR
Lob_loc in Clob Character Set any_cs,
Amount in integer: = 32767,
OFFSET in integer: = 1)
Return varchar2 character set lob_loc% charset;
I know, there is a dbms_lob this package, take a try, I found that dbms_lob.substr is easy to use in 8i, Read seems to be, huh, but the problem is solved.
DBMS_LOB.SUBSTR
Lob_loc in Clob Character Set any_cs,
Amount in integer: = 32767,
OFFSET in integer: = 1)
Return varchar2 character set lob_loc% charset;
I know, there is a dbms_lob this package, take a try, I found that dbms_lob.substr is easy to use in 8i, Read seems to be, huh, but the problem is solved.