Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: SQL decode question
I think he/she is trying to do a homework assignment :) The email header
indicates that this is an Oracle employee!
"Daniel Morgan" <damorgan_at_exesolutions.com> wrote in message
news:3CB758D5.A46F9BE2_at_exesolutions.com...
> You can not do what you are trying to do with decode.
>
> What I can't tell ... is what you are trying to do.
>
> Daniel Morgan
>
>
> Anton An wrote:
>
> > Hi all,
> >
> > I have a question regarding the decode function in SQL. I am trying to
> > use it in the following way
> > select
> > decode(Document.type, 'Long Text', Long_Document.long_text, 'Short
> > Text', Short_Document.short_text, '')
> > ...
> > from... where...;
> >
> > The problem is that Long_Document.long_text is of type LONG, while
> > Short_Document.short_text is of type VARCHAR2(2000). I know decode is
> > expecting the parameters to have the same data type, so I was trying to
> > use some conversion functions (like to_char). But I was still given
> > "inconsistent datatype" error.
> >
> > Any ideas?
> >
> > Thanks in advance!
> >
> > Anton
>
Received on Mon Apr 15 2002 - 13:00:46 CDT