语法逻辑:
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