Click to See Complete Forum and Search --> : decode query


aprelanto
04-19-2006, 04:08 AM
hi guys

hope everyone will be fine.

I am facing a problem in using decode query function. actually i have three fields in my table

FieldA VARCHAR
FieldB VARCHAR
FeildC Long

now in Fielda if there is '+' then Field C should be shown. I am writing query like this.

select FieldA, decode(FieldA,'+',FieldC) from abc

i am getting this error

"ORA-00997: Illegal use of LONG datatype"

is it means that decode can't be used with the LONG datatype.

please help

graham_o
04-19-2006, 06:56 AM
you need to write a function that will convert long to varchar2 so that you can select it. this link should give you a headstart

http://asktom.oracle.com/pls/ask/f?p=4950:8:::::F4950_P8_DISPLAYID:839298816582

aprelanto
04-20-2006, 01:33 AM
you need to write a function that will convert long to varchar2 so that you can select it. this link should give you a headstart

http://asktom.oracle.com/pls/ask/f?p=4950:8:::::F4950_P8_DISPLAYID:839298816582


well thanks

I use CASE in the query & it solved my problem :)