Oracle创建返回结果集的存储过程以及在PLSQL中调用

144 阅读1分钟

前提scott有travelrecord表

--/
create or replace procedure pro_data(data out SYS_REFCURSOR) is  
begin  
  open data for select id from scott.travelrecord;
end pro_data; 

/
alter procedure pro_data compile;

 

在PLSQL-Test Window中调用

begin  
 pro_data(data=> :data);
end;

下方Variable-Type-Value窗口会显示变量

其中Value右侧的省略符点开就是结果集