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

Last updated on JULY 17, 2016

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
Information in this document applies to any platform.
***Checked for relevance on 17-Jul-2016***

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

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 hundreds of Community platforms