Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

help with for loop

Status
Not open for further replies.

ddiamond

Programmer
Apr 22, 2005
918
US
I found the following syntax diagram for a for loop:
Code:
>>-+---------+---FOR--for-loop-name--AS-------------------------> 
   '-label:--' 

>-----+--------------------------+--select-statement---DO------->
      '-cursor-name--CURSOR FOR--' 

      .-------------------------------. 
      V                               | 
>--------SQL-procedure-statement--;---+--END FOR----+--------+-><
                                                    '-label--'
Has anyone successfully used the cursor name clause. Whenever I try it I get a syntax error message.

Code:
begin atomic
  declare commitcount integer default 1;
  
  for row as cr cursor for select * from geniusdata.pm_policy_master
  do
    delete from geniusdata.pm_policy_master where current of cr;
    if commitcount>=5000 then
      commit;
      set commitcount = 1;
    else
      set commitcount = commitcount + 1;
    end if;
  end for;
  
  commit;
end

SQL0104N An unexpected token "cr cursor for" was found
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top