Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: Triggers in package
"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 >
>
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
![]() |
![]() |