NVL changing data type of a datetime?
Posted in 2005
Hi all,
I'm seeing some unusual behaviour in IDS 9.40.UC7
I've a table with a nullable datetime year to second column. For rows
where it's null I want CURRENT so I use a simple NVL. Trouble is, the
result of that seems different in 9.40.UC7
create table tbl (time datetime year to second);
insert into tbl values ('2005-01-01 00:00:00');
select
time,
nvl(time,CURRENT),
nvl(time,CURRENT year to second),
nvl(time,extend('2005-01-01 00:00:00', year to fraction))
from tbl;
With IDS 9.40.UC7 that query gives me this:
time 2005-01-01 00:00:00
(expression) 2005-01-01 00:00:00.000
(expression) 2005-01-01 00:00:00
(expression) 2005-01-01 00:00:00.000
Note the milliseconds in 2 of the columns (.000 because I've got
USEOSTIME turned off).
With all other versions of IDS I have to hand (7.31.UD2R1, 7.31.UD9,
9.30.UC1, 9.40.FC5, 10.00.UC1) the milliseconds are not returned, i.e.
the query gives me this:
time 2005-01-01 00:00:00
(expression) 2005-01-01 00:00:00
(expression) 2005-01-01 00:00:00
(expression) 2005-01-01 00:00:00
It looks like IDS 9.40.UC7 is casting the NVL to the data type of the
second NVL argument whereas other versions keep the column's own data
type.
Obviously, I could make sure I use CURRENT year to second, but there
are a lot of other queries using plain CURRENT scattered around our
code that could have problems with the millseconds.
Does anyone have any ideas why IDS 9.40.UC7 is doing this and if
there's a way to change it?
Thanks,
JC