Subject [ib-support] ISNULL
Author Aleš Kahánek
... posting this again, maybe someone can help me ... :o) Thanks

Hi All,
can you help me with the 'ISNULL' problem?
I have tried the tbudf.dll where some NULL functions are in this dll.
Suppose you have table

CREATE TABLE MYTABLE (
...
MYCOLUMN NUMERIC(15,2);
...
)

and you want to do a select in a stored procedure like

SELECT SUM(MYCOLUMN)
FROM MY TABLE
WHERE SOMECONDITION
INTO :MYSUM;

Then you always need to check, if the MYSUM variable is NULL (for example if
the SELECT returns no rows, the result is always NULL). To avoid writing the
IF (MYSUM IS NULL) THEN MYSUM=0 after every select I tried

SELECT INVL(SUM(MYCOLUMN), 0)...
SELECT DNVL(SUM(MYCOLUMN), 0)...

but the results were not as one would expect.
INVL returns correctly 0 when the sum result is NULL, otherwise it returns
value 100 times bigger (due to numeric 15.2 probably).
DNVL returns _always_ 0.

The INULLIF and DNULLIF returns always NULLs.
Probably I am doing somethin wrong. I did not find any documentation about
these functions so I tried myself...

Thanks in advance
Ales







To unsubscribe from this group, send an email to:
ib-support-unsubscribe@egroups.com



Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/