Convert long to varchar2
570628Mar 31 2011 — edited Mar 31 2011Hi 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 !