Trigger on a view

Hi,
using Oracle 9i + wli 8.1 sp2 + RDBMS adapter.
can i set the trigger on a view and not on a table ?
This way I can define a subset of the table to be checked if it changed and not
the whole table.
(i tried it with no success)
Yuval

Feel like I'm getting really close to figuring this out. I created an mv on the db link like so:
DROP MATERIALIZED VIEW mv_Test_SYSDATE
CREATE MATERIALIZED VIEW mv_Test_SYSDATE
TABLESPACE users
REFRESH COMPLETE
START WITH SYSDATE
NEXT SYSDATE + 0.002 AS
SELECT acctnum, name, odometer, lastdate, cardnumber
from card@myaccessdb
If i go into the access db and insert a new record I can see the record count in the mv change after a few minutes (i'm guessing 2.8 minutes).
Which makes me happy. The problem now is that when i set up my trigger like so:
CREATE OR REPLACE TRIGGER "AZ"."TEST_MV_TRIGGER"
AFTER INSERT ON AZ.MV_TEST_SYSDATE
FOR EACH ROW
BEGIN
INSERT INTO TEST ("ACCTNUM","NAME","ODOMETER","LASTDATE","CARDNUMBER")
VALUES (:new.acctnum,:new.name,:new.odometer,:new.lastdate,:new.cardnumber);
END;
It actually does fire off of the mv which is a positive. But when i look in table test i see that it has pumped every record over, instead of just the newly added one from the access db.
I can understand why because i suppose the mv refresh is for the entire table. but I'm not at where I want to be because I want to capture the delta on the access table.
Any ideas?

Similar Messages

  • Issue with instead of trigger on a view

    Gurus,
    I have an issue with an instead of trigger on a view. The trigger is listed below. The insert and update seem to be working fine but the delete section is not.
    From the application, we have a screen on which we attach images. We trigger of an insert and update when we attach images. We are using hibernate as our object relational mapping tool.
    We have added some logging into the delete section but that portion of the trigger does not seem to be executing at all.
    Please advise.
    Thanks
    Hari
    CREATE OR REPLACE TRIGGER trg_vw_result_image_uid
    INSTEAD OF
    INSERT OR DELETE OR UPDATE
    ON vw_result_image
    REFERENCING NEW AS NEW OLD AS OLD
    DECLARE
    v_cnt number(38);
    v_cnt_old number(38);
    v_err_msg VARCHAR2 (250);
    BEGIN
    -- v_rslt_id number(38);
    -- v_cnt number(38);
    select count(1) into v_cnt from result_image_master
    where RSLT_IMAGE_ID = :new.RSLT_IMAGE_ID;
    --select count(1) into v_cnt from result_image_master
    -- where ACC_BLKBR_ID = :new.ACC_BLKBR_ID
    -- and upper(RSLT_IMAGE_NM) = upper(:new.RSLT_IMAGE_NM);
    select count(1) into v_cnt_old from result_image_master
    where RSLT_IMAGE_ID = :old.RSLT_IMAGE_ID;
    insert into t2( TEXT_VAL, DT1, seq1)
    values (' before v_cnt', sysdate, t6.NEXTVAL);
    --if v_cnt = 0
    --****INSERTING
    IF INSERTING
    THEN
    insert into t2( TEXT_VAL, DT1, seq1)
    values (' v_cnt is 0 and inserting into result_image_master', sysdate, t6.NEXTVAL);
    insert into t2( TEXT_VAL, DT1, seq1)
    values (' inserted bb id :'||:new.ACC_BLKBR_ID, sysdate, t6.NEXTVAL);
    insert into result_image_master (
    RSLT_IMAGE_ID
    ,RSLT_IMAGE_HBR_VER
    ,RSLT_IMAGE_TYPE_ID
    ,RSLT_IMAGE_NM
    ,RSLT_IMAGE_LABEL
    ,RSLT_IMAGE_SEQ
    ,RSLT_SHOW_ON_RPT
    ,RSLT_SLIDE_NO
    ,RSLT_CELL_NO
    ,RSLT_X_COORD
    ,RSLT_Y_COORD
    ,ACC_BLKBR_ID
    ,CREATED_BY
    ,DATE_CREATED
    ,MODIFIED_BY
    ,DATE_MODIFIED
    values (
    :new.RSLT_IMAGE_ID
    ,:new.RSLT_IMAGE_HBR_VER
    ,:new.RSLT_IMAGE_TYPE_ID
    ,:new.RSLT_IMAGE_NM
    ,:new.RSLT_IMAGE_LABEL
    ,:new.RSLT_IMAGE_SEQ
    ,:new.RSLT_SHOW_ON_RPT
    ,:new.RSLT_SLIDE_NO
    ,:new.RSLT_CELL_NO
    ,:new.RSLT_X_COORD
    ,:new.RSLT_Y_COORD
    ,:new.ACC_BLKBR_ID
    ,:new.CREATED_BY
    ,:new.DATE_CREATED
    ,:new.MODIFIED_BY
    ,:new.DATE_MODIFIED
    insert into result_image_blob (
    RSLT_IMAGE_ID
    ,rslt_image_blob
    values (
    :new.RSLT_IMAGE_ID
    ,:new.rslt_image_blob
    --****UPDATING
    ELSIF UPDATING
    -- v_cnt > 0 --
    THEN
    insert into t2( TEXT_VAL, DT1, seq1)
    values (' updating result_image_master', sysdate, t6.nextval);
    insert into t2( TEXT_VAL, DT1, seq1)
    values (' updating bb id :'||:new.ACC_BLKBR_ID, sysdate, t6.nextval);
    update result_image_master
    set RSLT_IMAGE_HBR_VER = RSLT_IMAGE_HBR_VER + 1
    ,RSLT_IMAGE_TYPE_ID = :new.RSLT_IMAGE_TYPE_ID
    ,RSLT_IMAGE_NM = :new.RSLT_IMAGE_NM
    ,RSLT_IMAGE_LABEL = :new.RSLT_IMAGE_LABEL
    ,RSLT_IMAGE_SEQ = :new.RSLT_IMAGE_SEQ
    ,RSLT_SHOW_ON_RPT = :new.RSLT_SHOW_ON_RPT
    ,RSLT_SLIDE_NO = :new.RSLT_SLIDE_NO
    ,RSLT_CELL_NO = :new.RSLT_CELL_NO
    ,RSLT_X_COORD = :new.RSLT_X_COORD
    ,RSLT_Y_COORD = :new.RSLT_Y_COORD
    ,ACC_BLKBR_ID = :new.ACC_BLKBR_ID
    ,MODIFIED_BY = :new.MODIFIED_BY
    ,DATE_MODIFIED = :new.DATE_MODIFIED
    where RSLT_IMAGE_ID = :new.RSLT_IMAGE_ID;
    update result_image_blob
    set rslt_image_blob = :new.rslt_image_blob
    where RSLT_IMAGE_ID = :new.RSLT_IMAGE_ID;
    END IF;
    IF DELETING OR v_cnt_old > 0
    THEN
    insert into t2( TEXT_VAL, DT1, seq1) values (' deleting rows ...', sysdate, t6.NEXTVAL);
    DELETE from result_image_blob where RSLT_IMAGE_ID = :old.RSLT_IMAGE_ID;
    insert into t2( TEXT_VAL, DT1, seq1) values ('deleting result_image_blob : '||:old.RSLT_IMAGE_ID , sysdate, t6.NEXTVAL);
    DELETE from result_image_master where RSLT_IMAGE_ID = :old.RSLT_IMAGE_ID;
    insert into t2( TEXT_VAL, DT1, seq1) values ('deleting result_image_master : '||:old.RSLT_IMAGE_ID , sysdate, t6.NEXTVAL);
    END IF;
    EXCEPTION
    WHEN OTHERS THEN
    v_err_msg := SQLERRM;
    insert into t2( TEXT_VAL, DT1, seq1) values (v_err_msg, sysdate, t6.nextval);
    END;
    Edited by: bhanujh on Sep 13, 2010 7:55 AM

    bhanujh wrote:
    The error msg that we are getting is
    09/08/2010 4:02:09 PM: Unable to save the results :: Could not execute JDBC batch updateSorry, we don't recognize this message as any valid Oracle error.
    :p

  • "instead of" trigger on a view with a condition

    I'm trying to create an instead-of trigger on a view but I want it all such that:
    1. It fires only for a certain condition.
    2. When the condition isn't met, I want the normal DML on the view to continue as it normally would.
    3. I want to avoid writing as much manual DML code as possible for long-term maintainability.
    My first attempt is like this:
    create or replace trigger PROPOSAL_PARTS_V_IRU
      instead of update on proposal_parts_v
      for each row
      WHEN :old.PART_MASTER_ID <> :new.PART_MASTER_ID
    BEGIN
      do_stuff_for_part_master_change;
    END;So when the OLD and NEW PART_MASTER_IDs have changed, I want special processing. Else, I want it to do whatever it normally does (let the view get updated and the database will manage the update of the underlying table).
    When compiling that I get "ORA-25004: WHEN clause is not allowed in INSTEAD OF triggers".
    OK I will accept that even though I want it to work.
    So my next attempt could be:
    create or replace trigger PROPOSAL_PARTS_V_IRU
      instead of update on proposal_parts_v
      for each row
    BEGIN
      IF :old.PART_MASTER_ID <> :new.PART_MASTER_ID THEN
        do_stuff_for_part_master_change;
      ELSE
        UPDATE proposal_parts -- Manually update the underlying table with manually-written DML but I hate having to do this in case the view or table columns change.
        SET...
        WHERE...
      END;So my question is...is there any syntax to do something like this?
    create or replace trigger PROPOSAL_PARTS_V_IRU
      instead of update on proposal_parts_v
      for each row
    BEGIN
      IF :old.PART_MASTER_ID <> :new.PART_MASTER_ID THEN
        do_stuff_for_part_master_change;
      ELSE
        update_row;
      END;...where "update_row" is some sort of built-in command that tells oracle to continue with the current update as if the trigger never existed.
    Back in the day I seem to remember that Oracle Forms had a trigger and syntax like this where you could intercept a DML and if under certain conditions it wasn't true, you could say "update_row" (or maybe it was "update_record?...whatever) and it meant "continue with update as if this instead-of trigger never existed".
    Is anything available like that for the DB now? I know in older versions no, but we are now on 11g...anything new come out like this?
    Otherwise I have to manually write an update statement and I'd rather not if I don't need to.
    Thanks!

    riedelme wrote:
    gti_matt wrote:
    I'm trying to create an instead-of trigger on a view but I want it all such that:
    1. It fires only for a certain condition.You can use IF Logic inside a trigger to do or not do anything. As long as it is a condition you can check you can code IF logic around it
    2. When the condition isn't met, I want the normal DML on the view to continue as it normally would.You will have to code all of your logic in the INSTEAD of trigger. The whole purpose of the INSTEAD OF trigger is to execute INSTEAD OF performing DML on the view. There is no way to go back to the "normal DML" when the INSTEAD OF trigger exists.
    You can put all of the logic you will need in the INSTEAD OF trigger and use IF conditions. Use IF logic to code both your special and "normal" processing.
    3. I want to avoid writing as much manual DML code as possible for long-term maintainability.You will have to code the operative lines somewhere. Reusable functions and/or procedures in a package?Yep using an "IF" I knew about...no problem there.
    But was just looking for a cheap and easy way to say (for the "else" condition) to revert to normal DML processing. Sounds like in a DB trigger there is no such syntax I guess.
    This is an example from Oracle Forms, I was looking for a database equivalent of this(see http://sqltech.cl/doc/dev2000/help/fbhelp18.htm):
    Built-in Subprograms for On-Event Triggers For most of the transactional On-event triggers, there is a corresponding built-in subprogram.
    On-Event Trigger
    Corresponding Built-in
    On-Delete
    DELETE_RECORD
    On-Insert
    INSERT_RECORD
    On-Update
    UPDATE_RECORD
    When you call one of these built-in subprograms from its corresponding transactional trigger, Form Builder performs the default processing that it would have done normally at that point in the transaction.
    For example, if you call the INSERT_RECORD procedure from an On-Insert trigger, Form Builder performs the default processing for inserting a record in the database during a commit operation.
    When these built-ins are issued from within their corresponding transactional triggers, they are known as do-the-right-thing built-ins. That is, they do what Form Builder would normally have done at that point if no trigger had been present. Thus, an On-Insert trigger that calls the INSERT_RECORD procedure is functionally equivalent to not having an On-Insert trigger at all. Such a trigger is explicitly telling Form Builder to do what it would have done by default anyway.Note that the author calls them the "do-the-right-thing" built-ins. That's what I was looking for but on the DB side. Sounds like Oracle didn't come up with that (yet)?

  • Trigger on a view on a linked db

    I have an access db that i have 'hooked' into with a database link inside of Oracle. I then have an oracle view based on that linked database so i can see the records that are over in access. This all works well. What i would like to do now is create a trigger that fires each time a new record is added over in access.
    I cannot create that trigger on the database link because it is DDL and that is prohibited.
    I cannot create an After Insert trigger on my oracle view because that is prohibited on views.
    I can create an Instead Of trigger on the view but it never fires because the insert takes place in access not in oracle.
    Is there any way for Oracle to 'detect' when a new record has been added in the Access database?

    Feel like I'm getting really close to figuring this out. I created an mv on the db link like so:
    DROP MATERIALIZED VIEW mv_Test_SYSDATE
    CREATE MATERIALIZED VIEW mv_Test_SYSDATE
    TABLESPACE users
    REFRESH COMPLETE
    START WITH SYSDATE
    NEXT SYSDATE + 0.002 AS
    SELECT acctnum, name, odometer, lastdate, cardnumber
    from card@myaccessdb
    If i go into the access db and insert a new record I can see the record count in the mv change after a few minutes (i'm guessing 2.8 minutes).
    Which makes me happy. The problem now is that when i set up my trigger like so:
    CREATE OR REPLACE TRIGGER "AZ"."TEST_MV_TRIGGER"
    AFTER INSERT ON AZ.MV_TEST_SYSDATE
    FOR EACH ROW
    BEGIN
    INSERT INTO TEST ("ACCTNUM","NAME","ODOMETER","LASTDATE","CARDNUMBER")
    VALUES (:new.acctnum,:new.name,:new.odometer,:new.lastdate,:new.cardnumber);
    END;
    It actually does fire off of the mv which is a positive. But when i look in table test i see that it has pumped every record over, instead of just the newly added one from the access db.
    I can understand why because i suppose the mv refresh is for the entire table. but I'm not at where I want to be because I want to capture the delta on the access table.
    Any ideas?

  • How to create a trigger on a view

    Hello all,
    I am trying to create a trigger on a view that is used to update a few columns in the base table. Since I am new to trigger, an example will be appreciated.
    Thanks in advance.

    Are you sure that you need a trigger for this? Lots of folks that are new to triggers tend to overuse them before they understand the maintenance problems that having a bunch of triggers creates.
    That said, the Oracle documentation has an example of [creating an INSTEAD OF trigger on a view|http://download.oracle.com/docs/cd/B14117_01/server.101/b10759/statements_7004.htm#i2064426]
    Justin

  • How to add trigger on materialized view?

    Hi, I'm trying to add trigger on materialized view. I don't know how to do it. I'm new to oracle and PL/SQL. Can you guys put some working example please? Thank you for every advise.

    Please check the below link. This answers you query:
    http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:672989600346945045

  • Trigger of a view

    Good morning,
    Does a trigger of a view start like a trigger of a table ?
    I mean, a view searches its data in a table of a linked DB. If a row is added in the table, will the trigger of the view run ?
    Thank you very much.
    Patrick

    If a row is added in the table, will the trigger of the view run ?Triggers on views are INSTEAD OF and are specified for views as objects - NOT the tables you include in your selection in views. Because of this only DML applied to views (not tables) fire "instead of" triggers:
    SQL> create table t (id number);
    Table created.
    SQL> create view t_v as select * from t;
    View created.
    SQL> create trigger tab_t
      2  before insert on t
      3  begin
      4   dbms_output.put_line('Table trigger');
      5  end;
      6  /
    Trigger created.
    SQL> create trigger view_tr
      2  instead of insert on t_v
      3  begin
      4   dbms_output.put_line('View trigger');
      5  end;
      6  /
    Trigger created.
    SQL> insert into t values(1);
    Table trigger
    1 row created.
    SQL> insert into t_v values(2);
    View trigger
    1 row created.Rgds.

  • Insted of trigger on Materialized view?

    Hi,
    Can we write insted of trigger on materialized view?
    Piyush

    peeyushgehlot wrote:
    When we do full refresh on materialized view, view gets truncated and new records get inserted, that's is on books and we can do job according, but when incremental refresh is done, what trigger will perform i am not sure.I'm not sure that I follow. A full refresh will cause insert triggers (row and table level, before and after) to fire for every row in the materialized view. An incremental refresh will cause insert, update, and delete triggers (row and table level, before and after) to fire for every row that is modified. There may, of course, be updates that don't actually change the data depending on how the materialized view is defined and how the changes need to be processed.
    Justin

  • Before update trigger on a view

    Hello,
    is not possible to write a before update or insert trigger based on a view?
    create or replace trigger trg_bef_upd_vwangajatiabsente
    before update on vw_angajati_absente
    referencing old as old new as new
    for each row
    begin
    if :old.motivabila='N' and :new.motivabila='D' then raise_application_error(-20433, 'Nu se poate modifica o absenta nemotivabila!');
    end;is it possible to solve these situations? :)
    Regards,

    Roger22 wrote:
    regarding to 2)
    in my trigger i must raise_application_error? if i don't raise then i need to issue update statements..... ?If you have an INSTEAD OF trigger that just has a body similar to the body you posted above, that would mean that update statements either
    - Raise an error
    - Do nothing (i.e. do not update any data in any table)
    That is a syntactically valid state-- Oracle will certainly allow you to have an INSTEAD OF UPDATE trigger that effectively throws away update statements. It's just that it would be rather rare that this would be the desired behavior. Presumably, if you're going through the effort of writing the trigger, you want certain update statements to succeed and, thus, to update data. If that is the case, your trigger would have to have UPDATE statements that update the proper row(s) in the proper base table(s).
    An INSTEAD OF UPDATE trigger is literally that. You are replacing, in its entirety, the update statement against the view with the code in your trigger. So your trigger would need to issue the base table updates that Oracle would have had there not been a trigger on the view.
    Justin

  • Create a trigger on a view

    I try to create a database trigger on a view and when the sql return a error (ORA-00439: feature not enabled: Instead-of triggers)
    How can i create the trigger?
    Pd. I don4t have problems to create then trigger on a table.

    Are you sure that you need a trigger for this? Lots of folks that are new to triggers tend to overuse them before they understand the maintenance problems that having a bunch of triggers creates.
    That said, the Oracle documentation has an example of [creating an INSTEAD OF trigger on a view|http://download.oracle.com/docs/cd/B14117_01/server.101/b10759/statements_7004.htm#i2064426]
    Justin

  • Instead of trigger not populating view

    I've got a interactive report. I created a view based on this so I can use it elsewhere. I had it wokring, have been distracted by other projects, came back and ARUGH...you know the story. The view is not updating with anything. Is it my trigger?
    VIEW
    CREATE OR REPLACE FORCE VIEW  "GET_USERNAME_VW" ("DOC_INFO_ID", "DOC_TITLE", "DOC_LINK", "ECRNO", "OWNER", "ISO_NUMBER", "STATUS_ID", "FILE_TYPE", "APPROVAL_REQ", "APPROVED", "JOB_DESC", "USER_NAME") AS
      select     "DOC_INFO"."DOC_INFO_ID" as "DOC_INFO_ID",
         "DOC_INFO"."DOC_TITLE" as "DOC_TITLE",
         "DOC_INFO"."DOC_LINK" as "DOC_LINK",
         "DOC_INFO"."ECRNO" as "ECRNO",
         "DOC_INFO"."OWNER" as "OWNER",
         "DOC_INFO"."ISO_NUMBER" as "ISO_NUMBER",
         "DOC_INFO"."STATUS_ID" as "STATUS_ID",
         "DOC_INFO"."FILE_TYPE" as "FILE_TYPE",
         "DOC_INFO"."APPROVAL_REQ" as "APPROVAL_REQ",
         "DOC_INFO"."APPROVED" as "APPROVED",
         "SH_JOB_DESCRIPTION"."JOB_DESC" as "JOB_DESC",
         "SH_EMPLOYEES"."USER_NAME" as "USER_NAME"
    from     "SH_EMPLOYEES" "SH_EMPLOYEES",
         "SH_JOB_DESCRIPTION" "SH_JOB_DESCRIPTION",
         "DOC_INFO" "DOC_INFO"
    where   "DOC_INFO"."OWNER"="SH_JOB_DESCRIPTION"."JOB_DESC"
        and     "SH_JOB_DESCRIPTION"."JOB_DESC_ID"="SH_EMPLOYEES"."JOB_DESC_ID"
    and "DOC_INFO"."STATUS_ID" IN (1,2)
    /TRIGGER
    create or replace TRIGGER "bi_GET_APPROVAL"
    INSTEAD OF UPDATE ON GET_USERNAME_VW
    REFERENCING NEW AS n                
    FOR EACH ROW
    BEGIN
    update doc_info
    set approval_req = :n.approval_req    
        WHERE DOC_INFO_ID = :old.DOC_INFO_ID;
    update doc_info
    set approved = :n.approved
        WHERE DOC_INFO_ID = :old.DOC_INFO_ID;
    END;

    My overlook - - In my testing I had been setting the status_id on my form to something other than 1 or 2. Friday afternoon has me making dumb mistakes - those kind that can really mess things up if you act on them. Better to take a break!
    Thanks anyway!!
    Have a great weekend.

  • PLEASE HELP!! Trigger on a view that updates a table synonym?

    I have a view (PERSONINFO_VIEW) that pulls user information from several ODS.CT tables. This view contains userid, first name, last name, telephone, and email. I'm trying to create a trigger that will insert these values into a remote table with a public synonym (PERSON_CTL_SYN) using a procedure. If I run the procedure alone, it works, and the table is updated. I enter data into the view (by adding a new user account to the portal) the PERSONINFO_VIEW is updated with the new information, but the trigger that calls the procedure doesn't seem to fire, because the PERSON_CTL_SYN is not updated.
    My trigger (PERSON_SYN_INS):
    On PTS.PERSONINFO_VIEW, INSTEAD OF EACH ROW, INSERT, ENABLED
    begin
    person_syn_ins_proc(:new.userid, :new.firstname, :new.lastname,:new.phone,:new.email);
    end;
    My Procedure (PERSON_SYN_INS_PROC):
    CUSER IN VARCHAR2,
    CFIRST IN VARCHAR2,
    CLAST IN VARCHAR2,
    CPHONE IN VARCHAR2,
    CEMAIL IN VARCHAR2
    as
    cSecrGrp varchar2(30) := 'ITSUSER';
    cLoc varchar2(30) := 'OUS-ITS';
    cArea varchar2(3) := '541';
    begin
    insert into person_ctl_syn(
    person_first_name,
    person_last_name,
    person_username,
    person_email,
    person_phone_number)
    values(
    cFirst,
    cLast,
    cUser,
    cEmail,
    cPhone);
    commit ;
    end;

    I have a view (PERSONINFO_VIEW) that pulls user information from several ODS.CT tables. This view contains userid, first name, last name, telephone, and email. I'm trying to create a trigger that will insert these values into a remote table with a public synonym (PERSON_CTL_SYN) using a procedure. If I run the procedure alone, it works, and the table is updated. I enter data into the view (by adding a new user account to the portal) the PERSONINFO_VIEW is updated with the new information, but the trigger that calls the procedure doesn't seem to fire, because the PERSON_CTL_SYN is not updated.
    My trigger (PERSON_SYN_INS):
    On PTS.PERSONINFO_VIEW, INSTEAD OF EACH ROW, INSERT, ENABLED
    begin
    person_syn_ins_proc(:new.userid, :new.firstname, :new.lastname,:new.phone,:new.email);
    end;
    My Procedure (PERSON_SYN_INS_PROC):
    CUSER IN VARCHAR2,
    CFIRST IN VARCHAR2,
    CLAST IN VARCHAR2,
    CPHONE IN VARCHAR2,
    CEMAIL IN VARCHAR2
    as
    cSecrGrp varchar2(30) := 'ITSUSER';
    cLoc varchar2(30) := 'OUS-ITS';
    cArea varchar2(3) := '541';
    begin
    insert into person_ctl_syn(
    person_first_name,
    person_last_name,
    person_username,
    person_email,
    person_phone_number)
    values(
    cFirst,
    cLast,
    cUser,
    cEmail,
    cPhone);
    commit ;
    end;

  • Trigger on materialized view

    i have a materialized view that is getting refreshed fast upon commit. i created an after insert trigger that for each new row on the view, inserts
    a row in a certain table. is this safe to do?

    No, it's not safe to do so.
    It was explained that Oracle does not guarantee how the changes are applied to the materialized view and in which order. Moreover the mechanism of the refresh could potentially change between releases. Also there were numerous bugs reported for the triggers created on MV container table.
    If you have access to Oracle Metalink look for the article [ID 67424.1].
    Good luck.
    Edited by: Max Seleznev on Dec 10, 2012 2:32 PM

  • Create trigger on view belong to different schema of same db

    Hi Guru's,
    I have two different schema in the same DB.
    Example : schema1 and schema2
    I have one view on schema1 and i have grant select to schema2 and create synonym for that view.
    Now i need to create trigger on synonym which created from view in schema1 and insert the data into different table from trigger when insert happen on view.
    first of all , is it possible?
    if its possible then do i need to give create any trigger on view to schema2.
    Or is there any other we can get this done..
    Many thanks.

    Hi,
    user590978 wrote:
    Hi Guru's,
    I have two different schema in the same DB.
    Example : schema1 and schema2
    I have one view on schema1 and i have grant select to schema2 and create synonym for that view.
    Now i need to create trigger on synonym I'm not sure I understand you.
    Triggers operate on tables and views (but I'll just say "table" from now on). It doesn't matter if the statement that caused the trigger to fire used the actual table name or a synonym.
    which created from view in schema1 and insert the data into different table from trigger when insert happen on view.
    first of all , is it possible?I'm not sure I understand you here, either.
    It is possible to have a trigger on a view in schema1, which INSERTs data into a table. That table can be in any schema, just so long as the trigger owner has privilges on INSERT into it.
    if its possible then do i need to give create any trigger on view to schema2.It's very dangerous, and usually a terrible idea, to grant the CREATE ANY privileges to users.
    Schema2 needs the CREATE ANY TRIGGER system privilege only to create a trigger in another schema, such as schema1. There's probably no reason to do that. Let schmea1 create the objects in its own schema.
    Post a test script that shows what you want to do. Include CREATE TABLE, CREATE VIEW, CREATE TRIGGER, CONNECT and INSERT statements, and the results you want (the contents of tables where the trigger INSERTed data). If you don't know how to code something, post the closest thing you can, and explain what you really want to do in that place.

  • Instead of trigger on view error

    I've created a view, a form on that view and an INSTEAD OF update trigger on that view. When I press the update button in the form I get
    Error: An unexpected error occurred: ORA-22816: unsupported feature with RETURNING clause (WWV-16016)
    The error changes if I remove the trigger, but I need the trigger because the view is not updateable. I've recreated the problem with a simple view on the emp table.
    Here's the emp view and trigger.
    create or replace view vw_emp
    as select *
    from emp;
    create or replace trigger vw_emp_burow
    instead of update on vw_emp
    referencing new as new old as old
    for each row
    begin
    null;
    end;In the emp case, the update proceeds fine once I drop the trigger.
    Is this a bug or have I done something wrong? Has anyone else tried this?
    (Portal 3.0.6.6.5 on 8.1.7 on Solaris)
    Responses appreciated.

    I was on the beta program, and ran into this problem with the beta version, and the EA version. Oracle told me that because of the underlying architecture of Oracle Portal, this was not easy to fix, so it would not be fixed in any 3.0 release.
    I am hoping they fix it in the 3.1 release, though that will not be out until something like next August.
    This is really an annoying bug, because using INSTEAD OF triggers on views would be a great way to make views that work well with Oracle Portal, while keeping the database normalized!
    Ken Atkins
    Computer Resource Team (www.crtinc.com)
    Check out my Oracle Tip site at:
    http://www.arrowsent.com/oratip
    null

Maybe you are looking for

  • Can I use my DAQ on two different computers?

    Hi there. Sorry if this might seem like a stupid question but I'm trying to save money lol. I have two test stations, each station has it's own computer and power supply. The power supply powers a certain device and the computer communicates with it

  • Button process with DBMS_SCHEDULER.run_job

    Hi, I need to execute the DBMS_SCHEDULER.run_job on click of a button . I tried creating a process (On submit) with DBMS_SCHEDULER.run_job('JOBNAME') when i tried executing directly in db there is no problem, but when i create the process in apex i a

  • Zero padding the LUN using dd command in Linux

    Grid Infrstructure: 11.2.0.3 OS : Oracle Enterprise Linux 6.3 When we were installing RAC in solaris, we used to zero pad all LUNs meant for ASM . We used to do like below dd if=/dev/zero of=/dev/rdsk/c0t600A0B8008A4CA005ACd0s0 bs=1024k count=2000Now

  • GRC 10.1 - Routing at Request Submission in case of SOD violations

    I am trying to configure MSMP workflow or risks analysis while creating userid 1. No Risks >> User created and access assigned automatically 2. Risks found >> forward to security team to review and approve I have checked the standard functional modul

  • 'Add files/folders to library...' comes up short

    Long long long time MusicMatch User and have started using iTunes thanks to Pepsi's promotion. When trying to import my existing music into iTunes, the process comes up about 20% short. A vast majority of my song files are in mp3 with a handfull of u