Oracle 10g 存储过程Cursor应用示例(TOAD)

A:简单使用cursor 进行批量数据操作

create or replace procedure INT5
(IDS in nvarchar2,NAMES in nvarchar2)
is
cursor cursor_1 is select CID FROM TEST WHERE CID < 5;
name nvarchar2(200);
begin
name:='';
open cursor_1;
loop
fetch cursor_1 into name;
exit when cursor_1 %NOTFOUND;

  dbms_output.put_line(name);
  INSERT into T1 (IDS,NAMES,CID) VALUES (IDS,NAMES,name);

end loop;
close cursor_1;
end INT5 ;

在TOAD中的调用方式:

BEGIN
 INT5('A','B');
 END;

 

 

posted @ 2009-01-21 15:16  mp3 swf  阅读(635)  评论(0编辑  收藏  举报