oraclestored-proceduresplsqldeveloperref-cursorrapidsql

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


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


Solution

  • 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.