Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Select LONG column into CLOB variable

441344Jun 6 2008 — edited Jun 9 2008
Hi all,

I am trying retrieve the data present in a LONG column into a CLOB variable.

However I am getting an error, pls let me know how I can resolve it.


DECLARE

v_text CLOB;

BEGIN


SELECT TO_LOB(trigger_body)
INTO v_text
FROM
user_triggers
WHERE
ROWNUM <= 1;

END;
/

ERROR at line 8:
ORA-06550: line 8, column 20:
PL/SQL: ORA-00932: inconsistent datatypes: expected NUMBER got LONG
ORA-06550: line 8, column 5:
PL/SQL: SQL Statement ignored


Let me know if there is an alternate to this. I would like to get the data present in the LONG column into a variable.

The reason why I am not retrieving the LONG column into LONG variable is stated below (from Oracle Website):

You can insert any LONG value into a LONG database column because the maximum width of a LONG column is 2**31 bytes.
However, you cannot retrieve a value longer than 32760 bytes from a LONG column into a LONG variable.

Thanks and Regards,
Somu
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 7 2008
Added on Jun 6 2008
6 comments
10,206 views