Subject SELECT in stored proc returns wrong value
Author Christian Gütter
Hi,

I have got the following problem:

When I

SELECT Val_Intern, Val_Extern FROM T_Stundensaetze WHERE
(Usr='TOWI')

and the user "TOWI" does not exist in "T_Stundensaetze" then
the select statement returns the value "NULL" for both "Val_Intern"
and "Val_Extern".
I think this works as it supposed to work.

But when I do the same select in a stored procedure (R_Usr = 'TOWI')

SELECT Val_Intern, Val_Extern FROM T_Stundensaetze WHERE
(Usr=:R_Usr)
INTO :L_Val_Intern, :L_Val_Extern;
if ((L_Val_Intern IS NULL) or (L_Val_Extern IS NULL)) then EXCEPTION
E_Kein_Stundensatz;

then the exception will not be fired because "L_Val_Intern" and
"L_Val_Extern" are not "NULL".
They should be "NULL", but they contain the values of the previous user
that was found by the
stored procedure.

So I wonder who is mixing something up: Interbase or me?
[Usually, it's silly me.]


TIA,


Christian