Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Triggers

Author  Topic 

theConfusedOne
Starting Member

1 Post

Posted - 2010-04-05 : 08:20:43
Hi Guys

I'm new to the forum so please excuse any mistakes i may make!
I am just beginning to learn SQL and PL/SQL.
I am having a spot of bother understanding triggers.
I have done some research and analysed the code to try and gain a better understanding of what format it is i need to be doing my trigger in.

As i cannot test out my code at home its hard to gain a good understanding of them right now.
If you guys could maybe suggest some helpfull resources and check my code to see if i am on the right lines i would be very grateful.

What i am trying to do is implement a PL?SQL trigger which will populate the column "volume" of the "furniture" table when an insert or update occurs.
The trigger should multiply the width * depth * height ( these columns are also contained within the table " furniture".

Here's what i have came up with so far..
CREATE OR REPLACE TRIGGER update_volume 
BEFORE
insert ON Furniture
FOR EACH ROW
BEGIN
:new.volume := :new.width* :new.depth* :new.height;

UPDATE Furniture
SET volume = :new.volume
WHERE furniture# = :new.furniture#;

END;


( I'm using Oracle 10g SQL)

pk_bohra
Master Smack Fu Yak Hacker

1182 Posts

Posted - 2010-04-05 : 08:30:17
Hi.

This is MS SQL server forum. You need to post your requirement in Oracle forum.

Regards,
Bohra
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-04-05 : 09:47:10
Try your luck at www.orafaq.com

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -