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!

Convert long to varchar2

570628Mar 31 2011 — edited Mar 31 2011
Hi there,

I am looking for a convertion, long to varchar2, in a sql statement.


If I run the following query :

select data_default from user_tab_columns

It works fine in sql developper but when I execute it in my PHP code it returns:

Notice: Undefined index: DATA_DEFAULT in /opt/lampp/htdocs/datamodel/index.php on line 64

This issue is due in the case where the columns has null.

So I try with the NVL function:

select nvl(data_default, 'null') from user_tab_columns

ORA-00932: inconsistent datatypes: expected LONG got CHAR



I found on internet some people are using the substr function but it did not working for me.

select substr(data_default, 1, 2000) from user_tab_columns

ORA-00932: inconsistent datatypes: expected NUMBER got LONG


Any one has an idea ?

Regards !
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 28 2011
Added on Mar 31 2011
2 comments
9,417 views