declare
cursor 游标名称
is
查询语句;
begin
--其他语句
end;
列子:
declare
cursor cur_stu
is
select name from student where id=2;
sname student.name%type;
result varchar2(20);
begin
open cur_stu;
loop
fetch cur_stu into sname;
exit when cur_stu%notfound;
result:=result||sname||'';
end loop;
dbms_output.put_line('我的名字叫' || result);
close cur_stu;
end;