trigger question [message #316491] |
Fri, 25 April 2008 06:23 ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
eyeball
Messages: 1 Registered: April 2008
|
Junior Member |
|
|
Hi all
Let's say I have a relation Employee(ID, Salary)
where ID is the key. I insert the relation some data(lines),
define the trigger(in the attached file), and then insert one more line to the relation.
what the trigger should do? since this is "for each statement"
trigger, what's the meaning of "Set salary"? to what line in the table will it refer?
Thanks!
-
Attachment: 1.JPG
(Size: 71.88KB, Downloaded 1161 times)
|
|
|
|
Re: trigger question [message #316501 is a reply to message #316491] |
Fri, 25 April 2008 06:59 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
![](/forum/images/custom_avatars/72104.gif) |
Littlefoot
Messages: 21823 Registered: June 2005 Location: Croatia, Europe
|
Senior Member Account Moderator |
|
|
What's the purpose of attaching a few lines of code trigger as an image?!? To make it more difficult to read?
Besides, there's no "for each STATEMENT" (at least, not in versions prior to 11g, and I can't speak for it and am not in the mood to check it), statements should end with a semi-colon (;), as well as PL/SQL block.
Furthermore, it seems that it is supposed to update ALL records in a table (as there's no WHERE clause in the UPDATE statement). However, it will never happen as such a trigger will raise an exception (a mutating table).
Not the best trigger I've seen, I'm afraid.
|
|
|
Re: trigger question [message #316719 is a reply to message #316501] |
Mon, 28 April 2008 01:01 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) |
Frank
Messages: 7901 Registered: March 2000
|
Senior Member |
|
|
Littlefoot wrote on Fri, 25 April 2008 13:59 | What's the purpose of attaching a few lines of code trigger as an image?!? To make it more difficult to read?
|
Too lazy to type the question, so he scanned it?
|
|
|