Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> Re: Find out the table name inside the trigger code
Zoran,
When you have very similar code, and it is 'copied' into a number of triggers, consider putting the code in a packaged procedure, and call this from your trigger. hard-coding (generating) the triggers is getting more straightforward then. And you can pass the tablename in the call, hardcoded (and generated).
It gives you one central point for maintenance, in stead of changing lots of triggers (and forgetting one every now and then).
Regards, Carel-Jan
===
If you think education is expensive, try ignorance. (Derek Bok)
===
> Stephane,
>
> Thanks a lot.
>
> That will do it :)
> But I am not going to do it, because it is more
> complicate then just fix the name in the triggers.
>
> It is easier to create the dynamic SQL to create the
> triggers then to do this :)
>
> The ugly thing is that I missed the chapter in the
> docs describing these special ora_... env variables.
> But, what I can do, just continue learning.
>
> Cheers,
> Zoran Martic
>
>
>
> --- Stephane Faroult <sfaroult_at_roughsea.com> wrote:
>
>> What I would suggest you is to use ora_sql_txt and
>> "parse" the text. It's fairly
>> easy to locate the tablename at the beginning of an
>> Insert/Update/Delete
>> statement, the only trick is probably to get rid of
>> comments and hints.
>> That said I would have no problem with hard-coding -
>> as long as I generate the
>> code ...
>>
>> Regards,
>>
>> Stephane Faroult
>>
>> RoughSea Ltd
>> http://www.roughsea.com
>>
>>
>> On Mon, 13 Dec 2004 02:09 , Martic Zoran
>> <zoran_martic_at_yahoo.com> sent:
>>
>> >Hi,
>> >
>> >Is it possible to find out the table name in the
>> >trigger code at execution time?
>> >
>> >Cannot figure out any possible way.
>> >
>> >Not crazy important but interesting if you want the
>> >trigger code across many tables to look the same
>> >(stupid, but anyway :)
>> >
>> >The solution can be some environment variable or
>> the
>> >custom SQL) or wahetever, just to not hard code the
>> >name of the table/trigger if possible :)
>> >
>> >Thanks in advance.
>> >
>> >Regards,
>> >Zoran Martic
>> >
>> >
>> >__________________________________________________
>> >Do You Yahoo!?
>> >Tired of spam? Yahoo! Mail has the best spam
>> protection around
>> >http://mail.yahoo.com
>> >--
>> >http://www.freelists.org/webpage/oracle-l
>>
>>
>>
>>
>>
>
>
>
>
> __________________________________
> Do you Yahoo!?
> Yahoo! Mail - now with 250MB free storage. Learn more.
> http://info.mail.yahoo.com/mail_250
> --
> http://www.freelists.org/webpage/oracle-l
>
-- http://www.freelists.org/webpage/oracle-lReceived on Mon Dec 13 2004 - 07:52:20 CST
![]() |
![]() |