oracle 存储过程 总结

create or replace procedure testone     --testone是存储过程名称
as
cursor test is select id,name from tbl_unit_type;  -- test是游标名称
typename varchar2(32);   --定义一个用于接收游标值得参数
begin

  for typename in test loop  --循环游标
    begin
        dbms_output.put_line(typename.id);   --获取id
        dbms_output.put_line(typename.name);   --获取name
     end;
  end loop;
end;

set serveroutput on;   --用于打印输出
execute testone;

原文地址:https://www.cnblogs.com/mingtian521/p/3120673.html