select user_profiles.user_ename
into t_user_ename//必须有into,保存到变量中
from tbname
where user_profiles.user_id=tbname.sales_id
into t_user_ename//必须有into,保存到变量中
from tbname
where user_profiles.user_id=tbname.sales_id
AS
TYPE myrctype IS REF CURSOR;
END pkg_test;
/create or replace function FNUSER_ENAME(tbname varchar2)
return pkg_test.myrctype is
v_rc pkg_test.myrctype;
Result varchar2(50);
begin
result:='select user_profiles.user_ename
from '||tbname||'
where user_profiles.user_id='||tbname||'.sales_id';
open v_rc for result;
return(v_rc);
end FNUSER_ENAME;
/