1. Get rid of all advertisements and get unlimited access to documents by upgrading to Premium Membership. Upgrade to Premium Now and also get a Premium Badge!

instead of triggers

Discussion in 'General' started by ghostrider, Mar 24, 2013.

  1. ghostrider

    ghostrider Active Member

    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    55
    I came across the following code for insteadof triggers
    Code (Text):
    Create view v-emp as
    select dname,ename
    from emp,dep
    where emp.dno=dep.dno;
     
    They had an explaination as "Normally this view wont update since d_id of dep table which is the P.K is not unique in the resultset of the join view"
    Now can someone please explain what the quoted statements actually mean?
     
  2. Bharat

    Bharat Community Moderator Forum Guru

    Messages:
    1,747
    Likes Received:
    147
    Trophy Points:
    1,805
    Location:
    Vijayawada, India
    What you are trying to do ?
     
  3. ghostrider

    ghostrider Active Member

    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    55
    I was just trying to understand what are instead of triggers when i came across this article..I understood what is insteadof trigger but i didnt understand the above statement regarding view update..Can you please explain it?
     
  4. Bharat

    Bharat Community Moderator Forum Guru

    Messages:
    1,747
    Likes Received:
    147
    Trophy Points:
    1,805
    Location:
    Vijayawada, India
    This line seems to be related to some issue while transacting the record. Can you please post the Article what you have gone through. By that we can analyze or we can look into it what they did...
     
  5. ghostrider

    ghostrider Active Member

    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    55
    I have attached the text file in which that article is please have a look at it..
     

    Attached Files:

  6. Bharat

    Bharat Community Moderator Forum Guru

    Messages:
    1,747
    Likes Received:
    147
    Trophy Points:
    1,805
    Location:
    Vijayawada, India
    What that sentence describes is we are trying to insert the record into employees and dept tables without their primary key fields. Thats the issue its raising here. So to overcome this issue here we are using instead of trigger and just putting the record into dept table with different sequence number as deptno. And moreover in that trigger its not yet inserting the record into employees table with employee name.