Oracle Training Oracle Support Development Oracle Apps

 E-mail Us
 Oracle Articles
New Oracle Articles

 Oracle Training
 Oracle Tips

 Oracle Forum
 Class Catalog

 Remote DBA
 Oracle Tuning
 Emergency 911
 RAC Support
 Apps Support
 Oracle Support

 SQL Tuning

 Oracle UNIX
 Oracle Linux
 Remote s
 Remote plans
 Application Server

 Oracle Forms
 Oracle Portal
 App Upgrades
 SQL Server
 Oracle Concepts
 Software Support

 Remote S


 Consulting Staff
 Consulting Prices
 Help Wanted!


 Oracle Posters
 Oracle Books

 Oracle Scripts

Don Burleson Blog 







Linda Webb

Got breaking Oracle news?    Burleson Consulting Oracle News

Click here for more Oracle News Headlines


Converting Oracle long raw to lob data types

Satyanarayana Reddy has published this method for converting LONG to LOB datatypes:



Using TO_LOB one can easily convert LONGS to LOBS.


Using the same conversion function one can convert LONG into CLOB and LONGRAW TO BLOB.


Have a look into following example


SQL>create table tlong(itemcd number(30),itemdesc long);


Table created.


SQL>Create table tlob(ItemCd Number(30),Itemdesc clob);

Table created


Now dump some values from some table into table tlong:


SQL>insert into tlong select icode,iname from InvTab;

2000 rows created.


Now try to insert into lob table from long table:


SQL>Insert into tlob select itemcd,TO_LOB(itemdesc) from tlong

2000 rows created.


but in PL/SQL you need to handle different way

normal select into insert will not work, but execute immediate will be the workaround in oracle 8.1.7


Let's see how it can be done PL/SQL:



insert into tlob select itemcd,TO_LOB(itemdesc) from tlong;




the above pl/sql block works well with Oracle 9i and Oracle 10g but fails in Oracle 8.1.7 with the following error:


ERROR at line 2:

ORA-06550: line 2, column 33:

PLS-00201: identifier 'TO_LOB' must be declared

ORA-06550: line 2, column 1:

PL/SQL: SQL Statement ignored


Then you should use dynamic SQL(Execute Immediate 'SQL statement') as follows:



execute immediate 'insert into tlob select itemcd,TO_LOB(itemdesc) from tlong';




Oracle Training at Sea
oracle dba poster

Follow us on Twitter 
Oracle performance tuning software 
Oracle Linux poster


Burleson is the American Team

Note: This Oracle documentation was created as a support and Oracle training reference for use by our DBA performance tuning consulting professionals.  Feel free to ask questions on our Oracle forum.

Verify experience! Anyone considering using the services of an Oracle support expert should independently investigate their credentials and experience, and not rely on advertisements and self-proclaimed expertise. All legitimate Oracle experts publish their Oracle qualifications.

Errata?  Oracle technology is changing and we strive to update our BC Oracle support information.  If you find an error or have a suggestion for improving our content, we would appreciate your feedback.  Just  e-mail:  

and include the URL for the page.


Burleson Consulting

The Oracle of Database Support

Oracle Performance Tuning

Remote DBA Services


Copyright © 1996 -  2017

All rights reserved by Burleson

Oracle ® is the registered trademark of Oracle Corporation.

Remote Emergency Support provided by Conversational