| Author |
Trigger
|
michell o'brien
Ranch Hand
Joined: Jun 09, 2009
Posts: 37
|
|
I have written a trigger not sure where I am going wrong. It is showing as Invalid trigger.
|
 |
John Bengler
Ranch Hand
Joined: Feb 12, 2009
Posts: 132
|
|
Hi Michell,
what exactly do you want this trigger to do?
John
|
 |
michell o'brien
Ranch Hand
Joined: Jun 09, 2009
Posts: 37
|
|
|
This is my first trigger. I am selecting some of the newly inserted values.using a trigger.
|
 |
John Bengler
Ranch Hand
Joined: Feb 12, 2009
Posts: 132
|
|
Ok, I see...
Wel, it looks as if you need some guidance on triggers.
Maybe you can start following one of these links:
Tutorial Oracle Triggers
When to use triggers
And one more thing: inside of a trigger you should avoid selects on the table of the trigger. See this:
Avoiding Mutating Tables
John
|
 |
michell o'brien
Ranch Hand
Joined: Jun 09, 2009
Posts: 37
|
|
Can anyone tell me what mistake I have done in Line 10. It gives me error code number PLSQL-00103
|
 |
John Bengler
Ranch Hand
Joined: Feb 12, 2009
Posts: 132
|
|
Hi michell,
I think when you work with cursors you have to open them, e.g.
Additionally I'm not sure if you're allowed to access table itemtype in your trigger,but since it is an AFTER trigger it may be allowed...
But I think you should read about the :new and : old parameters available in triggers.
If you just want to add an item everytime a new itemtype was added you could write:
So for each row which was inserted into itemtypes an entry into item is made.
If you create this trigger before the firstentry into itemtype was made it will have the same effect as your trigger - of course without "cleaning up" items whose itemtype has been deleted. For this you would need an additional ON DELETE trigger..
John
|
 |
 |
|
|
subject: Trigger
|
|
|