How to test an Oracle Stored Procedure with RefCursor return type?

前端 未结 6 930
庸人自扰
庸人自扰 2020-12-02 12:13

I\'m looking for a good explanation on how to test an Oracle stored procedure in SQL Developer or Embarcardero Rapid XE2. Thank you.

6条回答
  •  长情又很酷
    2020-12-02 12:59

    Something like

    create or replace procedure my_proc( p_rc OUT SYS_REFCURSOR )
    as
    begin
      open p_rc
       for select 1 col1
             from dual;
    end;
    /
    
    variable rc refcursor;
    exec my_proc( :rc );
    print rc;
    

    will work in SQL*Plus or SQL Developer. I don't have any experience with Embarcardero Rapid XE2 so I have no idea whether it supports SQL*Plus commands like this.

提交回复
热议问题