ORA-00997: illegal use of LONG datatype

I got ” ORA-00997: illegal use of LONG datatype ” error in Oracle database during create table as select * from ( CTAS )

 

ORA-00997: illegal use of LONG datatype

 

Details of error are as follows.

SQL> CREATE TABLE test_table AS SELECT data_default FROM user_tab_cols;
CREATE TABLE test_table  AS SELECT data_default FROM user_tab_cols
*
ERROR at line 1:
ORA-00997: illegal use of LONG datatype


SQL>
   

 

 

illegal use of LONG datatype

This ORA-00997: errors are related with the LOB Objects conversion.

 

To solve this error, you can use the TO_LOB function to convert long data to LOB as follows.

 

SQL> CREATE TABLE test_table AS SELECT TO_LOB(data_default) data_default FROM user_tab_cols;

Table created.

SQL> desc test_table;
Name Null? Type
----------------------------------------- -------- ----------------------------
DATA_DEFAULT CLOB

SQL>

 

Or you can use expdp impdp of related table if you want to move table.

Or you can remove the LONG value from the function or clause in a DISTINCT, WHERE, CONNECT BY, GROUP BY, or ORDER BY clause.

 

Do you want to learn Oracle Database for Beginners, then read the following articles.

Oracle Tutorial | Oracle Database Tutorials for Beginners ( Junior Oracle DBA )

 

About Mehmet Salih Deveci

I am Founder of SysDBASoft IT and IT Tutorial and Certified Expert about Oracle & SQL Server database, Goldengate, Exadata Machine, Oracle Database Appliance administrator with 10+years experience.I have OCA, OCP, OCE RAC Expert Certificates I have worked 100+ Banking, Insurance, Finance, Telco and etc. clients as a Consultant, Insource or Outsource.I have done 200+ Operations in this clients such as Exadata Installation & PoC & Migration & Upgrade, Oracle & SQL Server Database Upgrade, Oracle RAC Installation, SQL Server AlwaysOn Installation, Database Migration, Disaster Recovery, Backup Restore, Performance Tuning, Periodic Healthchecks.I have done 2000+ Table replication with Goldengate or SQL Server Replication tool for DWH Databases in many clients.If you need Oracle DBA, SQL Server DBA, APPS DBA,  Exadata, Goldengate, EBS Consultancy and Training you can send my email adress [email protected].-                                                                                                                                                                                                                                                 -Oracle DBA, SQL Server DBA, APPS DBA,  Exadata, Goldengate, EBS ve linux Danışmanlık ve Eğitim için  [email protected] a mail atabilirsiniz.

Leave a Reply

Your email address will not be published. Required fields are marked *