Provide ability to fetch NOT all fields from explicitly declared cursor: fetch 
field1, field2  FROM  <C> into :v1, :v2
----------------------------------------------------------------------------------------------------------------------

                 Key: CORE-4554
                 URL: http://tracker.firebirdsql.org/browse/CORE-4554
             Project: Firebird Core
          Issue Type: Improvement
            Reporter: Pavel Zotov
            Priority: Minor


Cursor with many fields which declared explicitly can be used in two or more 
places of same PSQL code.
In place-1 we need all of his fields but in place-2 - only several or even one.
It can be useful if FETCH <C> statement will be added with option to specify 
only those fields which are needed now, i.e.:
FETCH [ field1[, field2...]  FROM ]  <C>  INTO <var1, ...> - and usage can be 
like this:

execute block as
  declare i int = 0;
  declare v_x int;
  declare v_y int;
  declare v_z int;
  declare c cursor for (select 1 x, 2 y, 3 z from rdb$database a);
begin
  open c;
  while(1=1) do begin
    if ( <some_cond> ) then
        fetch c into :v_x, :v_y,  :v_z; -- current use: fetch ALL fields and 
provide ALL needed variables for them
    else
        fetch x, z FROM c into :v_x, :v_z; -- here we take only two fields (and 
specify them) and put their values in two variables

    if ( row_count =0 ) then leave;
  end
  close c;
end

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

------------------------------------------------------------------------------
Want excitement?
Manually upgrade your production database.
When you want reliability, choose Perforce
Perforce version control. Predictably reliable.
http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk
Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to