开发者

Continue statement in Pl/sql

开发者 https://www.devze.com 2023-03-09 18:40 出处:网络
I am working Oracle 10g. I am running this pl/sqlblock Declare cursor Get_Data is select * from employee for update;

I am working Oracle 10g. I am running this pl/sql block

Declare
cursor Get_Data is select * from employee for update;
data Get_Data%rowtype;

Begin

for data in Get_Data loop
  if(data.salary=5000) then 
  continue; 
  else 
   update employee set salary= 开发者_JAVA百科salary+3000 where current of Get_Data;
  end if;
end loop;
end;

It is giving me this Error : identifier 'CONTINUE' must be declared

please suggest me how to resolve this problem.


Just a note: CONTINUE is supported only in Oracle 11g.

Refer here: Oracle® Database PL/SQL Language Reference 11g Release 1 (11.1) > What's New in PL/SQL? > CONTINUE Statement


Try

Declare
    cursor Get_Data is select * from employee for update;
    data Get_Data%rowtype;

    Begin

    for data in Get_Data loop
      if(data.salary<>5000)
           update employee set salary= salary+3000 where current of Get_Data;
      end if;
    end loop;
    end;
0

精彩评论

暂无评论...
验证码 换一张
取 消