Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Triggers in package

Re: Triggers in package

From: shakespeare <whatsin_at_xs4all.nl>
Date: Mon, 19 Nov 2007 22:19:28 +0100
Message-ID: <4741fdea$0$238$e4fe514c@news.xs4all.nl>

"Maxim Demenko" <mdemenko_at_gmail.com> schreef in bericht news:4740B90D.7050009_at_gmail.com...
> shakespeare schrieb:

>> "Maxim Demenko" <mdemenko_at_gmail.com> schreef in bericht 
>> news:4740A02C.7060403_at_gmail.com...
>>> GeezerButler schrieb:
>>>> Hi, I am totally new to Oracle so beware of stupidity :)
>>>>
>>>> Can triggers be defined inside a package?
>>> No triggers can't be defined inside a package.
>>> There is a very good source regarding triggers, packages and similar 
>>> things
>>> http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14261/toc.htm
>>>
>>> Best regards
>>>
>>> Maxim
>>
>> But: triggers can call code in packages. Which has the advantage they're 
>> compiled in stead of interpreted.
>>
>> Shakespeare
>

> This has some advantages, but not one you mentioned (if i am not wrong, at
> least since 8i). You may be interested to read this thread on AskTom
> http://asktom.oracle.com/pls/asktom/f?p=100:11:3002549113972976::::P11_QUESTION_ID:149212348066
> or search this newsgroup - it was discussed here in the past a lot.
> However, i don't clear understand, what is your point - i think, the
> question was clearly stated and clearly answered - and my point was: the
> thema is way too complex to diskuss it in usenet post.
> In my opinion, if somebody is totally new to Oracle, the best place to
> start is the Oracle documentation, in no way it is the usenet group. Don't
> take me personally, but all what you said can be wrong. Equally well, all
> what i say may be wrong. As it can be from everybody from the regulars
> here.
> That is why, in my opinion, if somebody begin to learn oracle, he should
> do it at right place, minimizing the risk to memorize wrong concept.
>

> Best regards

>
> Maxim

Ok, I found this one:

Triggers are similar to PL/SQL anonymous blocks with the addition of the :new and :old capabilities, but their compilation is different. A PL/SQL anonymous block is compiled each time it is loaded into memory. Compilation involves three stages:

  1.. Syntax checking: PL/SQL syntax is checked, and a parse tree is generated.

  2.. Semantic checking: Type checking and further processing on the parse tree.

  3.. Code generation: The pcode is generated.

Triggers, in contrast, are fully compiled when the CREATE TRIGGER statement is entered, and the pcode is stored in the data dictionary. Hence, firing the trigger no longer requires the opening of a shared cursor to run the trigger action. Instead, the trigger is executed directly.

I just did not read any further than the first 2 lines.... ;-) Missed the last 2...

BTW, I'm not a beginner as you did suggest. Just getting old and tired. That's all....

Putting trigger code in packages (but not the trigger itself) has one advantage though: grouping all trigger code together in an easy to maintain, easy to find module.

Shakespeare

Shakespeare Received on Mon Nov 19 2007 - 15:19:28 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US