CREATE TABLE trg_test (p NUMBER); CREATE OR REPLACE TRIGGER trg_test BEFORE INSERT -- ... ON trg_test DECLARE ls_owner sys.v_$access.owner%TYPE; BEGIN -- dbms_output.enable; SELECT a.owner INTO ls_owner FROM sys.v_$session s , sys.v_$access a WHERE s.audsid = SYS_CONTEXT('USERENV', 'SESSIONID') AND s.sid = a.sid AND a.object = 'TRG_TEST' AND a.type = 'TRIGGER' ; -- dbms_output.put_line('Owner of the trigger is ' || ls_owner); END; / -- Vladimir Begun The statements and opinions expressed here are my own and do not necessarily represent those of Oracle Corporation.
Post, Ethan wrote:
Anyone know how to get the owner of a trigger inside a trigger without using the stack dump shown here by Tom Kyte which would still need some work to get just the owner name. http://groups.google.com/groups?q=get+table+owner+in+trigger+oracle&hl=en&lr =&ie=UTF-8&oe=UTF-8&selm=337efeab.1901213%40newshost&rnum=1 I have the same trigger in same database in different environments (DEV,TEST,QA) and the trigger needs to send info using UTL_FILE to different directories based on which environment the trigger is in. Refreshes from production are automated but the production trigger get put in these other environments and I want the same trigger to run everywhere without modification. Current plan is to figure out the owner and set the path for UTL_FILE based on that. Any ideas. Thanks, Ethan
-- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Vladimir Begun INET: [EMAIL PROTECTED] Fat City Network Services -- 858-538-5051 http://www.fatcity.com San Diego, California -- Mailing list and web hosting services --------------------------------------------------------------------- To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).