自定義遊標結果集

-----自定義遊標結果集
create or replace procedure getStuMy(sage integer)
  is
  type mytype is ref cursor;--自定義動態遊標的類型爲mytype
   stu_cur mytype;          --指定stu_cur的類型爲mytype
   type stutype is record(
      name studenback.name%type,
      age  studenback.age%type
   );
   stu stutype;
begin
   open stu_cur for select name,age from studenback where age > sage;-- 給遊標stu_cur賦值並開啓遊標
  loop
    fetch stu_cur into stu;
    exit when stu_cur%notfound ;
    dbms_output.put_line(' name = '||stu.name||' age= '||stu.age);
  end loop;
end;

execute getStuMy(18);oop

相關文章
相關標籤/搜索