Odd Stored Procedure Results
Posted in 1996
Hello. I'm getting an odd result when I run the following stored
procedure:
create procedure test() returning integer; define result int;
select min(preference) into result from codeset;
return result;
end procedure;
In my example, the table codeset has two rows and the column preference
has values 1 and 2 in those rows. I would expect this procedure to
return a 1 every time. Instead, if I run it six times in a row I get the
following results: 1, 2, null, 1, 2, null.
However, if I just execute the same select statement six times (outside
of the procedure), I get 1 every time as expected.
I have rewritten the procedure to use a cursor now, but I was curious as
to why this didn't work. Any ideas would be appreciated.
Jay D. Sullivan
jsulliva@eag.mhs.compuserve.com