Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Trigger i Oracle Expand / Collapse
Author
Message
Posted Tuesday, March 26, 2013 5:49 AM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Today @ 6:55 AM
Points: 227, Visits: 721
Hi Team,

Am new to Oracle, i need a trigger

i have a table named Stud:
Columns : ID, Stud_Name,

Another table named : Lab
Columns : ID, Stud_ Name

i want to trigger, when ever any insert or update or delete on Stud, it need to check the Id, Stud_Name in Lab table, if available, then get

the ID and udpate status ='Y' where TABLE = "APP"


Table : APP
Columns : ID, Status

Please help me....
Post #1435405
Posted Tuesday, March 26, 2013 6:20 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Today @ 4:51 AM
Points: 12,918, Visits: 32,085
Minnu this looks a lot like homework, and we hate to do folks work on their behalf, because they don't learn the concepts they need later;

Oracle triggers are different than SQL triggers, as they are performed per row; a lot of us work in both environments, so you should still be able to get help here, even though it's a SQL Server Centric Forum.

If you can show us what you have so far, we can help push you in the right direction.


Lowell

--There is no spoon, and there's no default ORDER BY in sql server either.
Actually, Common Sense is so rare, it should be considered a Superpower. --my son
Post #1435425
Posted Tuesday, March 26, 2013 7:14 AM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Today @ 6:55 AM
Points: 227, Visits: 721
i've done below.....

CREATE TRIGGER TRG_TMP
AFTER INSERT OR UPDATE OR DELETE
OF ID or Stud_Name
ON
STUD
BEGIN

--
here i need oracle query to compare the ID, stud_name in two tables,
and i want to update APP table.

END


Please help me...
Post #1435465
Posted Tuesday, March 26, 2013 7:31 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Today @ 4:51 AM
Points: 12,918, Visits: 32,085
take a look at the syntax for an oracle trigger here:

there's an example there, and you can see how fields are referenced with the :columnname indicator

see if that helps you build a better trigger;

http://www.techonthenet.com/oracle/triggers/after_update.php


Lowell

--There is no spoon, and there's no default ORDER BY in sql server either.
Actually, Common Sense is so rare, it should be considered a Superpower. --my son
Post #1435475
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse