Given this table,
CREATE TABLE test (
c01 INT,
c02 NUMBER(10,5),
c03 NUMBER(18,10)
);
I use OCCI (the C++ Library) to execute the following SELECT query:
select case(c01) when 10 then c02 else c03 end from test;
In this case, the typecode I get is OCCI_SQLT_NUM but the precision and scale both are 0. What does that (0 precision and scale) mean? Is this a bug?
Without knowing the precision/scale, the type-safety, semantics and the correctness of the program is at the stake, as it is not possible to decide whether to treat it as integer or floating-point.
In other words, what is the type of the CASE(x) WHEN y THEN a ELSE b expression? Can a be INT and b be CHAR[32]? I think no. So how is the type computed?