Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Long to Varchar2

vpolasaJan 9 2020 — edited Jan 9 2020

I'm trying to run below query but getting error:

SELECT substr(data_default, 1, 4000) FROM USER_TAB_COLUMNS WHERE DATA_DEFAULT IS NOT NULL;

ORA-00932: inconsistent datatypes: expected CHAR got LONG

00932. 00000 -  "inconsistent datatypes: expected %s got %s"

*Cause:   

*Action:

Error at Line: 128 Column: 18

I understand SUBSTR accepts VARCHAR2. Can someone assist me with a different approach to address this issue?

Using: Windows 10

Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production

PL/SQL Release 12.1.0.1.0 - Production

"CORE 12.1.0.1.0 Production"

TNS for 64-bit Windows: Version 12.1.0.1.0 - Production

NLSRTL Version 12.1.0.1.0 - Production

This post has been answered by Solomon Yakobson on Jan 9 2020
Jump to Answer
Comments
Post Details
Added on Jan 9 2020
3 comments
1,276 views