My Oracle Support Banner

How to overcome a few restrictions of LONG data type (Doc ID 205288.1)

Last updated on MAY 06, 2024

Applies to:

Oracle Database - Personal Edition - Version 7.3.3.0 and later
PL/SQL - Version 7.2.2.4 and later
Oracle Database - Enterprise Edition - Version 8.0.3.0 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.

Symptoms

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. 

Changes

No relevant change to the database has been done. 

Cause

To view full details, sign in with your My Oracle Support account.

Don't have a My Oracle Support account? Click to get started!


My Oracle Support provides customers with access to over a million knowledge articles and a vibrant support community of peers and Oracle experts.