Subject | Re: [firebird-support] CURSOR logic |
---|---|
Author | Ivan Prenosil |
Post date | 2006-05-30T12:12:30Z |
> Does the following SUSPEND the last record of the table or should theYou can find the answer in Release Notes.
> code be written as below the first example?
What are you trying to do ? Can't you use FOR SELECT ?
Ivan
----- Original Message -----
From: "Raymond Kennington" <raymondwk@...>
To: "fb-support" <firebird-support@yahoogroups.com>
Sent: Tuesday, May 30, 2006 2:03 PM
Subject: [firebird-support] CURSOR logic
Does the following SUSPEND the last record of the table or should the
code be written as below the first example?
The second sequence appears to test for an empty remaining set prior to
fetching. The first sequence appears to FETCH before testing if there
are any rows available to retrieve.
Thanks.
Raymond.
DECLARE RNAME CHAR(31);
DECLARE C CURSOR FOR ( SELECT RDB$RELATION_NAME
FROM RDB$RELATIONS );
BEGIN
OPEN C;
WHILE (1 = 1) DO
BEGIN
FETCH C INTO :RNAME;
IF (ROW_COUNT = 0) THEN
LEAVE;
SUSPEND;
END
CLOSE C;
END
DECLARE RNAME CHAR(31);
DECLARE C CURSOR FOR ( SELECT RDB$RELATION_NAME
FROM RDB$RELATIONS );
BEGIN
OPEN C;
WHILE (1 = 1) DO
BEGIN
IF (ROW_COUNT = 0) THEN
LEAVE;
FETCH C INTO :RNAME;
SUSPEND;
END
CLOSE C;
END