/*** DDL ***/
begin
EXECUTE IMMEDIATE
EXECUTE IMMEDIATE
end;
/*** DML ***/
declare
v_
v_
str varchar
begin
v_
v_
str :=
EXECUTE IMMEDIATE str USING v_
commit;
end;
declare
str varchar
c_
r_
begin
c_
str:=
execute immediate str into r_
DBMS_OUTPUT
end ;
CREATE OR REPLACE package pkg_test as
/* 定義ref cursor類型
不加return類型
否則為強類型
*/
type myrctype is ref cursor;
function get(intID number) return myrctype;
end pkg_test;
/
CREATE OR REPLACE package body pkg_test as
function get(intID number) return myrctype is
rc myrctype;
sqlstr varchar
begin
if intID=
open rc for select id
else
sqlstr :=
open rc for sqlstr using intid;
end if;
return rc;
end get;
end pkg_test;
/
From:http://tw.wingwit.com/Article/program/Oracle/201311/17186.html