How to display the results of a ref cursor using SQL Developer

前端 未结 1 771
野的像风
野的像风 2021-01-28 16:46

I have a stored procedure with several cursors. They are defined as IN OUT parameters. I would like to display the result of the cursors using SQL Developer. This is an exampl

相关标签:
1条回答
  • 2021-01-28 17:15

    Two ways SQL Developer supports this - the GUI and the Code.

    The GUI

    If you execute your stored procedure from the Code Editor, find the stored procedure in the tree, click on it, use the Execute button - we'll grab ALL of your output, and show it below in the output panels:

    And your attempt, the Code:

    If you're in the SQL Worksheet and you have your anonymous block, you can run it with F5, including your print command.

    Like so -

    create or replace function get_emps(dno in number) return sys_refcursor
        is
          return_value sys_refcursor;
        begin
          open return_value for
            select * from employees where department_id = dno;
          return return_value;
        end;
        /
    
    
    
     var rc refcursor
     exec :rc := get_emps(90)
    
     print rc
    

    0 讨论(0)
提交回复
热议问题