Results 1 to 5 of 5
  1. #1
    Join Date
    Feb 2004
    Location
    Chicago
    Posts
    3

    Question Unanswered: Instead of Trigger

    How they work ?

    I have a table A with all possible trigger on that table.
    If I create a view B based on table A and then create instead of trigger will it fire ?

  2. #2
    Join Date
    Feb 2004
    Posts
    108
    I would suggest you to try and see what happens !
    The Instead-Of trigger gives you the control over the view and the base table(s).
    In Instead of insert trigger on View B you can do the processing that is required whenever user tries to insert record in View B. You can insert record in Table A itself. But now when you try to insert into Table A - say insert into TableA Values ....., your on-insert trigger in Table A will fire. But this trigger will not know, on it's own, that the original source is the instead-of trigger !
    Hope this helps.

  3. #3
    Join Date
    Feb 2004
    Location
    Chicago
    Posts
    3
    Originally posted by pinakdb
    I would suggest you to try and see what happens !
    The Instead-Of trigger gives you the control over the view and the base table(s).
    In Instead of insert trigger on View B you can do the processing that is required whenever user tries to insert record in View B. You can insert record in Table A itself. But now when you try to insert into Table A - say insert into TableA Values ....., your on-insert trigger in Table A will fire. But this trigger will not know, on it's own, that the original source is the instead-of trigger !
    Hope this helps.

    Does the view have to be materialized or just a simple view ?

  4. #4
    Join Date
    Feb 2004
    Posts
    108
    Just an ordinary view.
    create view v1 as select * from t1 ;

  5. #5
    Join Date
    Feb 2004
    Posts
    108
    may have more than one base tables ...

    create view v1 as select t1.c1 col1, t2.c1 col2, t1.c2 col2 from t1, t2 where t1.join_col = t2.join_col ;

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •