How to determine a PL/SQL function's schema from within the function
oracle, plsql
Solution
create function xcurr return varchar2 is
v_curr varchar2(32);
begin
SELECT SYS_CONTEXT ('USERENV', 'CURRENT_USER') into v_curr from dual;
return v_curr;
end;
This will work as long as the PL/SQL object doesn't have AUTHID CURRENT_USER.
Problem
I have a PL/SQL package in an Oracle 10g database and I want to write a function that returns the name of the schema that the package (and hence the function) is defined in. Anyone know how to do this?