What does zero precision and scale mean for Oracle number type

From: Tom Higgins <tom.removethis_at_velara.com>
Date: Wed, 3 Oct 2001 19:43:18 -0400
Message-ID: <9nNu7.1600$872.51589_at_e3500-atl2.usenetserver.com>


hi there,

I have a peculiar problem. My client application generates dynamic SQL whenever
new updates enter the system, like the ones given below:

T(x int, y float)

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 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 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 categorise alias1, alias2 and alias3 as either an INTEGER,
FLOAT or a DECIMAL (with a fixed precision and scale).

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 like
alias2 and alias3 (which helps me to properly figure out the datatypes of alias2 and alias3).
Is there anything I can do to properly find the datatype of alias1??

regards,
sashi Received on Thu Oct 04 2001 - 01:43:18 CEST

Original text of this message