Home » Other » Training & Certification » trigger question
trigger question [message #316491] Fri, 25 April 2008 06:23 Go to next message
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 191 times)
Re: trigger question [message #316496 is a reply to message #316491] Fri, 25 April 2008 06:42 Go to previous messageGo to next message
Michel Cadot
Messages: 64103
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
You should ask these questions to your teacher.

Regards
Michel
Re: trigger question [message #316501 is a reply to message #316491] Fri, 25 April 2008 06:59 Go to previous messageGo to next message
Littlefoot
Messages: 20888
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
Frank
Messages: 7880
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?
Previous Topic: I need help in my project.. please
Next Topic: confused please
Goto Forum:
  


Current Time: Sat Dec 03 01:18:15 CST 2016

Total time taken to generate the page: 0.07175 seconds