Re: data types of aliases

From: Jim Kennedy <kennedy-family_at_attbi.com>
Date: Thu, 07 Nov 2002 02:30:19 GMT
Message-ID: <%eky9.134993$wG.495357_at_rwcrnsc51.ops.asp.att.net>


There is no cast function in Oracle. Sounds like a Sybase or SQLServer function.
They also should be using host variables. Jim
"Sashi Parthasarathy" <zsltfx7c02_at_sneakemail.com> wrote in message news:mzgy9.180$uwT2.9896074_at_news2.randori.com...
>
> Hi,
>
> I have a peculiar problem. My client application generates dynamic SQL
> whenever
> new updates enter the system.
>
> For eg., I have a table T(x int, y float). My application generates
 queries
> like the ones
> given below.
>
> Query 1: select CAST(2 as int) as alias1, T.x as alias2, T.y as alias3
 where
> T.x > 0;
> Query 2: select CAST(2.0 as float) as alias1, T.x as alias2, T.y as alias3
> where T.y > 0;
>
> I use OCI calls to determine the data type and the values of alias1,
 alias2
> and alias3.
> Oracle treats alias1, alias2 and alias3 as SQLT_NUM type. Based on the
 scale
> and precision
> returned by the OCIAttrGet() call, I have to categorize alias1, alias2 or
> alias3
> as either an INTEGER, FLOAT or a DECIMAL.
>
> The problem arises when I try to categorise alias1 as an integer in Query
 1
> and alias1 as a
> float in Query 2. OCIAttrGet() returns 0 for both scale and precision for
> alias1 in both
> the queries whereas it returns the proper scale and precision for other
> attributes, namely,
> alias2 and alias3 (which helps me to properly figure the datatypes of
 alias2
> and alias3).
> Is there anything I can do to properly find the datatype of alias1??
>
> Thanks,
> Sashi
>
>
>
Received on Thu Nov 07 2002 - 03:30:19 CET

Original text of this message