Subject | Re: [ib-support] CURSOR or WHERE CURRENT OF in a stored procedure |
---|---|
Author | Dimitry Sibiryakov |
Post date | 2003-06-06T02:56:24Z |
On 5 Jun 2003 at 10:26, Martijn Tonies wrote:
FOR SELECT .... DO
IF (<very complex condition that can't be used in WHERE clause>) THEN
DELETE .... WHERE CURRENT OF ...;
More useful example by Dmitri Popov - INSERT_OR_UPDATE:
AValue = NULL;
FOR SELECT PK_Field FROM ATable WHERE ... INTO :AValue
AS CURSOR TmpCursor DO
UPDATE ATable SET .... WHERE CURRENT OF TmpCursor;
IF (AValue IS NULL) THEN
INSERT INTO ATable ....;
SY, Dimitry Sibiryakov.
>DELETE FROM MyTable ... WHERE CURRENT OF MyCursor;A bit abstract example:
>
>But I don't understand it's functionality :-/
FOR SELECT .... DO
IF (<very complex condition that can't be used in WHERE clause>) THEN
DELETE .... WHERE CURRENT OF ...;
More useful example by Dmitri Popov - INSERT_OR_UPDATE:
AValue = NULL;
FOR SELECT PK_Field FROM ATable WHERE ... INTO :AValue
AS CURSOR TmpCursor DO
UPDATE ATable SET .... WHERE CURRENT OF TmpCursor;
IF (AValue IS NULL) THEN
INSERT INTO ATable ....;
SY, Dimitry Sibiryakov.