1. 程式人生 > 其它 >Oracle 動態遊標測試

Oracle 動態遊標測試

技術標籤:Oracle

語法邏輯:
open [cursor] for [query_code] for [para1,para2…]
下文中的例子:=2 就是第一個引數名;

-- Created on 12/18/2020 by BRANDONXIAN 
declare
    type c_refcur        is ref cursor;
    c_data               c_refcur;
    l_str                varchar2(100):='select 1 ids from dual where 1=:2;';
    l_idss                number:=
1; l_r number; begin -- Test statements here if not c_data%isopen then open c_data for l_str using l_idss; end if; fetch c_data into l_r; close c_data; dbms_output.put_line('l_ids:'||l_r); end;

結果輸出:

輸出: l_ids:1