Trigger i Oracle

  • 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....

  • 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!

  • 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...

  • 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!

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply