insert into returns 0 rows
From: Agoston Bejo <gusz1_at_freemail.hu>
Date: Wed, 27 Oct 2004 15:17:33 +0200
Message-ID: <clo7dl$iev$1_at_news.caesar.elte.hu>
Hi,
when a SELECT in an INSERT INTO statement returns no rows, NO_DATA_FOUND exception is raised. How do I write a "nice" SELECT INTO when I expect that 0 or 1 row gets returned, and the variable should be NULL if no rows are returned.
By "nice" I mean that my intention is clear from the source code and no exception-catching is involved, since that would suggest that I'm handling such a condition that shouldn't occur.
Therefore the following two techniques are not satisfying:
myvar := NULL
END; Received on Wed Oct 27 2004 - 15:17:33 CEST
Date: Wed, 27 Oct 2004 15:17:33 +0200
Message-ID: <clo7dl$iev$1_at_news.caesar.elte.hu>
Hi,
when a SELECT in an INSERT INTO statement returns no rows, NO_DATA_FOUND exception is raised. How do I write a "nice" SELECT INTO when I expect that 0 or 1 row gets returned, and the variable should be NULL if no rows are returned.
By "nice" I mean that my intention is clear from the source code and no exception-catching is involved, since that would suggest that I'm handling such a condition that shouldn't occur.
Therefore the following two techniques are not satisfying:
SELECT MIN(thefield) INTO myvar ... -- (not clear what is intended)
BEGIN --exception handling where no real exceptional condition occurs
SELECT thefield INTO myvar...
myvar := NULL
END; Received on Wed Oct 27 2004 - 15:17:33 CEST