Re: select from dual, typecasted
From: Mark D Powell <Mark.Powell_at_eds.com>
Date: Mon, 25 May 2009 08:00:13 -0700 (PDT)
Message-ID: <21fdad61-145c-4915-9c40-18c3cf3e8bb7_at_h23g2000vbc.googlegroups.com>
On May 25, 7:49 am, "Laurenz Albe" <inv..._at_spam.to.invalid> wrote:
> jodleren wrote:
> > I need to typecast one item, as I select from dual union something
> > else...
>
> > select '1' as amount from dual
> > union select ....
>
> > where it should be:
>
> > select longvarchar('1') as amount from dual
>
> > how do I achieve that?
>
> http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/functi...
>
> Yours,
> Laurenz Albe
Date: Mon, 25 May 2009 08:00:13 -0700 (PDT)
Message-ID: <21fdad61-145c-4915-9c40-18c3cf3e8bb7_at_h23g2000vbc.googlegroups.com>
On May 25, 7:49 am, "Laurenz Albe" <inv..._at_spam.to.invalid> wrote:
> jodleren wrote:
> > I need to typecast one item, as I select from dual union something
> > else...
>
> > select '1' as amount from dual
> > union select ....
>
> > where it should be:
>
> > select longvarchar('1') as amount from dual
>
> > how do I achieve that?
>
> http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/functi...
>
> Yours,
> Laurenz Albe
For other like me who did not recognize longvarchar it would appear to be an Oracle java type that corresponds to sqlj.runtime.CharacterStream which replaces the obsoleted AsciiStream and UnicodeStream types.
Ref:
http://download.oracle.com/docs/cd/B19306_01/java.102/b16018/typesupp.htm#sthref318
If the process allows consideration should be given to performing the data conversion from numeric to character in the Oracle union SQL statement itself via the to_char function. The to_char function can also be used to format the output to a fixed size using leading zeroes if useful or necessary to match up the data correctly.
HTH -- Mark D Powell -- Received on Mon May 25 2009 - 10:00:13 CDT