Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> triggers/storedproc help.....
hello first off I am taking a course on Database Modelling with little
emphasis on triggers
and/or stored procedures so dont percieve that this is doing my homework
for me :}
I am just trying to implement a little database for my own learning....
Ok its a video rental type thing... the two relevent tables are..
Checkout ... (a bridge table with VID_NUM representing the video
identification number)
which is a foriegn key to...
ForRent ... (Composite Primary key... VID_NUM and VID_NAME..... with an
attribute
called VID_NUMINSTOCK which is hopefully self
describing.... )
I created a trigger that works ok but with obvious limitations......
RUN
CREATE OR REPLACE TRIGGER TRG_CHECKOUT_AJUST_STOCK
AFTER INSERT OR UPDATE OF VID_NUM ON CHECKOUT
BEGIN
UPDATE FORRENT
set VID_NUMINSTOCK = VID_NUMINSTOCK - 1;
END;
The trigger updates all the VID_NUMINSTOCK fields in the ForRent
table.....
As you can guess i need only to reduce the VID_NUMINSTOCK where the
update
is occuring on only one peticular VID_NUM......
Hopefully I am explaining my "querry" adaquately (pardon the pun!).....
If I have not given enough of a description of the table and or details
please let me know..
Any help would be greatly appreciated! Thx in advance D.Moore (motivated rookie) Received on Wed Jun 25 2003 - 16:43:08 CDT
![]() |
![]() |