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?
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With