CREATE OR REPLACE
package pkg_test as
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 varchar2(500);
begin
if intID=0 then
open rc for select id,name,sex,address,postcode,birthday from student;
else
sqlstr := 'select id,name,sex,address,postcode,birthday from student where id=:w_id';
open rc for sqlstr using intid;
end if;
return rc;
end get;
end pkg_test;
/
package pkg_test as
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 varchar2(500);
begin
if intID=0 then
open rc for select id,name,sex,address,postcode,birthday from student;
else
sqlstr := 'select id,name,sex,address,postcode,birthday from student where id=:w_id';
open rc for sqlstr using intid;
end if;
return rc;
end get;
end pkg_test;
/
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货