On Jul 24, 2009, at 2:59 PM, David E. Wheeler wrote:
> FETCH have INTO rec_have;
> FETCH want INTO rec_want;
> WHILE NOT rec_have IS NULL OR NOT rec_want IS NULL LOOP
> IF rec_have IS DISTINCT FROM rec_want THEN
> RETURN false;
> END IF;
> rownum = rownum + 1;
> FETCH have INTO rec_have;
> FETCH want INTO rec_want;
> END LOOP;
> RETURN true;
Bah. It fails to do what I want when I pass cursors that return:
VALUES (NULL, NULL), (NULL, NULL) VALUES (NULL, NULL)
So when it gets to that second row in the first cursor, it doesn't
know it's a row with NULLs as opposed to an empty row. So this bit:
WHILE NOT rec_have IS NULL OR NOT rec_want IS NULL LOOP
Obviously isn't detecting the difference. I tried
WHILE (NOT rec_have IS NULL AND rec_have IS DISTINCT FROM NULL) OR (NOT rec_want IS NULL AND rec_want IS
DISTINCTFROM NULL)
and
WHILE (NOT rec_have IS NULL AND NOT rec_have IS NOT DISTINCT FROM
NULL) OR (NOT rec_want IS NULL AND NOT rec_want IS NOT DISTINCT FROM
NULL)
But they didn't work, either.
There's got to be a way to do this; better, there ought to be an easy
way to tell the difference. :-(
Thanks,
David