How to overcome a few restrictions of LONG data type
(Doc ID 205288.1)
Last updated on FEBRUARY 14, 2022
Applies to:Oracle Database - Personal Edition - Version 126.96.36.199 and later
PL/SQL - Version 188.8.131.52 and later
Oracle Database - Enterprise Edition - Version 184.108.40.206 and later
Oracle Database Cloud Schema Service - Version N/A and later
Oracle Database Exadata Cloud Machine - Version N/A and later
Information in this document applies to any platform.
You try to select distinct values from a long column, create a table using as select with a long column, insert into a table by selecting the long column from another table and an ORA-00997: illegal use of LONG datatype ... occurs
It is a restriction of the long columns that they cannot be used with a DISTINCT operator and cannot be referenced when creating a table with query
(CREATE TABLE...AS SELECT...) or when inserting into a table(or view) with a query (INSERT INTO ... SELECT...).
This article gives a workaround to these restrictions using a table function in 8i and above.
This workaround is applicable if and only if your data in the long column is less than 4K.
No relevant change to the database has been done.
To view full details, sign in with your My Oracle Support account.
Don't have a My Oracle Support account? Click to get started!