SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Trigger i Oracle


Trigger i Oracle

Author
Message
Minnu
Minnu
Mr or Mrs. 500
Mr or Mrs. 500 (553 reputation)Mr or Mrs. 500 (553 reputation)Mr or Mrs. 500 (553 reputation)Mr or Mrs. 500 (553 reputation)Mr or Mrs. 500 (553 reputation)Mr or Mrs. 500 (553 reputation)Mr or Mrs. 500 (553 reputation)Mr or Mrs. 500 (553 reputation)

Group: General Forum Members
Points: 553 Visits: 950
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....
Lowell
Lowell
One Orange Chip
One Orange Chip (28K reputation)One Orange Chip (28K reputation)One Orange Chip (28K reputation)One Orange Chip (28K reputation)One Orange Chip (28K reputation)One Orange Chip (28K reputation)One Orange Chip (28K reputation)One Orange Chip (28K reputation)

Group: General Forum Members
Points: 28371 Visits: 39959
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

--
help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

Minnu
Minnu
Mr or Mrs. 500
Mr or Mrs. 500 (553 reputation)Mr or Mrs. 500 (553 reputation)Mr or Mrs. 500 (553 reputation)Mr or Mrs. 500 (553 reputation)Mr or Mrs. 500 (553 reputation)Mr or Mrs. 500 (553 reputation)Mr or Mrs. 500 (553 reputation)Mr or Mrs. 500 (553 reputation)

Group: General Forum Members
Points: 553 Visits: 950
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...
Lowell
Lowell
One Orange Chip
One Orange Chip (28K reputation)One Orange Chip (28K reputation)One Orange Chip (28K reputation)One Orange Chip (28K reputation)One Orange Chip (28K reputation)One Orange Chip (28K reputation)One Orange Chip (28K reputation)One Orange Chip (28K reputation)

Group: General Forum Members
Points: 28371 Visits: 39959
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

--
help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search