简单的存储过程

CREATE OR REPLACE PROCEDURE SP_A_TEST_PROCEDURE(PCUR_Result  OUT Sys_Refcursor,
                                                result_two   OUT Sys_Refcursor,
                                                pd_BeginTime in DATE,
                                                pd_EndTime   in DATE) is
  type emp_job is record(
    empno number,
    ename varchar2(20),
    job   varchar2(30));

  type emp_refcur is ref cursor return emp_job; -- 声明 REF CURSOR
  emp_sor emp_refcur;
  emp_i   emp_job;

begin
    
  OPEN emp_sor FOR
    SELECT 1 empno, 'ename' ename, 'job' job from dual;

  loop
    fetch emp_sor
      into emp_i;
    exit when emp_sor% notfound;
 
    dbms_output.put_line(emp_i.ename);
 
  end loop;

  close emp_sor;
 
  OPEN result_two FOR
    select 'test' from dual;
  OPEN PCUR_Result FOR
    select 'test' from dual;

end SP_A_TEST_PROCEDURE;

你可能感兴趣的:(存储过程)