Issue Details (XML | Word | Printable)

Key: CORE-1044
Type: New Feature New Feature
Status: Open Open
Priority: Major Major
Assignee: Unassigned
Reporter: Alexander Tyutik
Votes: 2
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
Firebird Core

Cursor variables

Created: 06/Dec/06 04:38 PM   Updated: 06/Dec/06 04:38 PM
Component/s: None
Affects Version/s: None
Fix Version/s: None


 Description  « Hide
It would be nice to have cursor variables and assign them diffirent cursors. For example

EXECUTE BLOCK (
  START_DATE TIMESTAMP,
  END_DATE TIMESTAMP)
RETURNS (
  ID INTEGER,
  NAME VARCHAR(100))
AS
  DECLARE CUR CURSOR (INTEGER, VARCHAR(100));
BEGIN
  IF (START_DATE IS NULL AND END_DATE IS NULL)
    CUR = CURSOR FOR SELECT ID, NAME FROM MY_TABLE;
  ELSE IF (START_DATE IS NOT NULL AND END_DATE IS NULL)
    CUR = CURSOR FOR SELECT ID, NAME FROM MY_TABLE WHERE CREATION_DATE >= :START_DATE;
  ELSE IF (START_DATE IS NULL AND END_DATE IS NOT NULL)
    CUR = CURSOR FOR SELECT ID, NAME FROM MY_TABLE WHERE CREATION_DATE <= :END_DATE;
  ELSE IF (START_DATE IS NOT NULL AND END_DATE IS NOT NULL)
    CUR = CURSOR FOR SELECT ID, NAME FROM MY_TABLE WHERE CREATION_DATE BETWEEN :START_DATE AND :END_DATE;

  FOR FETCH FROM CUR INTO :ID, :NAME DO
  BEGIN
     ...
     SUSPEND;
  END

--OR
  
  OPEN CUR;
  WHILE (1=1) DO
  BEGIN
     FETCH CUR INTO :ID, :NAME;
    IF(0 = ROW_COUNT)
      BREAK;
    ...
  END
  CLOSE CUR;

END


 All   Comments   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
There are no comments yet on this issue.