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.

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)?

  • Instead of Trigger not working as expected

    We use a view v_test ( union on two tables ) with an Instead of Trigger for insert. The Instead of Trigger just inserts data into one of the underlying tables.
    If we insert a single row ( insert into v_test(...) values(...) ) everything works fine.
    If we insert multiple rows using one statement ( insert into v_test(...) select ...) some columns have same values although they should be different.
    (tested on Oracle 9 and 10)

    here is an example (Oracle Version is 9.2.0.6.0):
    view vtest_:
    SELECT *
    FROM (SELECT * FROM EM_TRANSPORTMITTEL_B
    UNION
    SELECT * FROM EM_TRANSPORTMITTEL_H)
    WHERE Nvl(To_Date(pa_session.f_getContext('hist_date'), 'dd.mm.yyyy hh24:mi:ss'), SYSDATE) BETWEEN hist_from AND hist_to
    Instead of Trigger:
    CREATE OR REPLACE TRIGGER tib_v_test instead of insert on v_test for each row
    declare
    l_cols EM_TRANSPORTMITTEL_B%rowtype;
    begin
    l_cols.EM_TRANSPORTMITTELID := :new.EM_TRANSPORTMITTELID;
    l_cols.tmtyp := :new.tmtyp;
    insert into EM_TRANSPORTMITTEL_B (em_transportmittelid, tmtyp, ....) values (l_cols.em_transportmittelid, l_cols.tmtyp, ....)
    end tib_v_test;
    Insert Statement
    insert into v_test (em_transportmittelid, tmtyp, ...)
    select em_transportmittelid, 'WAGEN' tmtyp, ...
    from tmp_tmstamm
    order by wagenummer;

  • INSTEAD of Trigger View for an Oracle EBS New form development

    Hello,
    I am developing a new EBS form based on a database view.
    This form is an EBS form will run in an 11.5.10.2 environment and developed using 6i.
    The form has one data block that is based on the view. The view is joined and based on following tables.
    Hz_Parties Hp,
    Hz_Cust_Accounts
    Hz_Cust_Acct_Sites_All
    Hz_Party_Sites
    Hz_Locations
    Ra_Salesreps_All
    Hz_Cust_Site_Uses_All
    Ar_Vat_Tax_All
    xx_custom_table t
    The view is inherently not updatable. Therefore, I am thinking to write an INSTEAD OF trigger on the view. The question. The form which is based on the view is require to update Oracle EBS tables mentioned above. As you know, there are APIs available to update above tables.
    Typically, you would write API in a program unit in the form and call from triggers. But here the form is based on the view. And to support DMLs on the view, I HAVE TO write INSTEAD of trigger(or that is the only way i know) so the question is:
    1. Do I write these APIs under INSTEAD of triggers?
    2. Or, I write these API in the form triggers and write DML referencing OLD and NEW values in INSTEAD of trigger? Where, these OLD and NEW values will refer on above tables.
    Please advise.
    And lastly, Do I have to write an INSTEAD of trigger? The USER_UPDATEABLE_COLUMNS view for this table shows no columns are updateable at the moment
    Thanks,
    A

    As you know, there are APIs available to update above tables.No, I don't B-) You'd better ask this in the eBusiness Suite form, as this is very EBS, not Forms, specific.
    In general, I would say that in this case you can use the EBS API's in the instead of trigger, not in the form.
    Or you can base the form on stored procedures, not directly on the view.

  • Form with view having instead-of-trigger gives FRM-40501 and ORA-02014

    I created a data-entry from with a 'view' as datas-source block. This view gives crosstab query results with a data from a single base-table but it is complex and uses decode and aggregate funciton 'max' just to create group by in a crosstab query. I have created a instead of trigger on this view to update or insert a record in base table. A test to update base table works fine at SQl prompt. A test to insert at SQL shows '1 row created' but in fact when I query the database, it does not show newly inserted row. Also, when I compile and run this form, I get FRM-40501 and ORA-02014. Help!!!
    I know that DML operations on a view with DECODE, aggregate functions or group by can not be performed but I thought the "instead of" trigger on the view to update the base table should eleminate this restriction and hence pusued further but now stuck!
    BTW: I can post details of base table, view, and instead of trigger, if you want to see them to further decipher the problem. Just let me know. Thanks!
    VERSIONS: Forms in developer suite v10.1.2.0.2 on Windows XP 64 bit desktop - ; Backend database: 9.2.0.8 on Windows 2003 EE server
    Edited by: user8647268 on Aug 19, 2009 1:19 PM
    Edited by: user8647268 on Aug 19, 2009 1:25 PM

    I just forgot to ask you one question: In my experience with forms, I have captured before_value and after_value and implemented logic based on results many times. This form I am working on is kinda first multi-record form where I have a tabular page with date and about 7 other columns forming a grid of cells, which users wanted. Each line is a record from a view. I tried relying on forms to do DML on underlying table and since the underlying table is a paritioned table, I ran into FRM-40509 and ORA-00936, where returning ROWID becomes problematic. I found a note 167550.1 which says to set Key mode to 'Updateable' or 'Non-Updateable' but not 'Unique' or 'Automatic' as a solution #1. Solution#1 failed i.e. the errors persisted. The note also says in that case, implement Solution #2, which is to write explicit trigger to do each of the DML on view. Here I run into kinda problem: In a tabular form with say 31 records each row having 7 cells which is like capturing 217 before values..that is too many. Addressing them with ':old.xxx' or ':new.xxx' which works in instead of trigger, does not work in trigger inside forms. Without checking these before and after values, it inserts rows with nulls for empty cells where we wnated it to skip and do nothing. So iam looking for a way to capture before value using some kinda standard form mechanism..Do you have any suggestions! (Sorry for long explanation but that is the only way to do it..)

  • View-Update in forms with Instead-Of trigger

    I has created a view and an Instead-Of trigger on that view.
    Now, I want to update this view in FORMS 6. I am unable to update this view and getting error FRM-40602.
    Is there any way to update this view updatable in FORMS6 or FORMS6 has not this feature?

    Hi,
    This has been acknowledged by Oracle as bug earlier. The work-around for this is as follows:
    1. Create table 1
    2. Create table 2
    3. Create view
    4. Create instead of insert trigger on view
    5. Create instead of update trigger on view
    6. Now, in the forms, go to the Block property
    7. Look for the 'Key mode' property. By default it is 'Automatic'. Set it to Updateable (If your database design supports updating primary keys) or Unique (preferable).
    8. Now run the form. It should work.
    All the best.
    Sunil Kumar G S

  • Instead-of Trigger of View on a Remote Table Fails!!!

    Hi all,
    I'm trying to create an INSTEAD OF (UPDATE or INSERT) trigger on a view V1 in DATABASE DB1 (Linux 7.3 or 7.2, ORACLE 9.2.0.1.0 - Production).The view V1 is created on a remote table through a DBLINK.But I always get such error when I update the view V1 using statements such as "update v1 set oid=oid+1000" :
    ORA-03113 end-of-file on communication channel
    But I can execute those statements successfully in Oracle of version 9.0.1.0.0 .
    What I want to say is that if some special configs is needed to support instead-of trigger of a view on a remote table ?

    Hi all,
    I'm trying to create an INSTEAD OF (UPDATE or INSERT) trigger on a view V1 in DATABASE DB1 (Linux 7.3 or 7.2, ORACLE 9.2.0.1.0 - Production).The view V1 is created on a remote table through a DBLINK.But I always get such error when I update the view V1 using statements such as "update v1 set oid=oid+1000" :
    ORA-03113 end-of-file on communication channel
    But I can execute those statements successfully in Oracle of version 9.0.1.0.0 .
    What I want to say is that if some special configs is needed to support instead-of trigger of a view on a remote table ?

  • INSTEAD OF TRIGGER

    제품 : PL/SQL
    작성날짜 : 1999-07-13
    INSTEAD OF Trigger
    1. 개념
    INSTEAD OF trigger는 Oracle8에서 새로이 소개된 방법으로, DML문장에 의해
    직접 변경할 수 없는 view를 변경하기 위해 사용된다. 즉, base table이 fire
    하는 trigger를 생성하는 것이 아니고 view를 대상으로 trigger를 생성하여
    view에 대한 DML문장을 수행시 대신 trigger가 fire되어 base table을 직접
    변경하게 되는 것이다.
    기본적으로 DML이 불가능한 view는 다음 사항들을 포함하고 있는 경우이
    다. 이러한 사항을 포함한 view들에 대해서 instead of trigger를 생성하면 DML을
    수행할 수 있게 된다.
    (1) DISTINCT operator
    (2) group functions: AVG, COUNT, MAX, MIN, STDDEV, SUM, VARIANCE등
    (3) set operations: UNION, MINUS 등
    (4) GROUP BY, CONNECT BY, START WITH clauses
    (5) ROWNUM pseudocolumn
    (6) join (updatable join view인 경우는 제한적으로 DML수행가능 <Bul:11642>참
    조)
    2. EXAMPLE
    instead of trigger의 예를 다음과 같이 작성하였다.
    (1) base tables
    create table dept
    (deptno number(4) primary key,
    dname varchar2(14),
    loc varchar2(13));
    create table emp
    (empno number(4),
    ename varchar2(10),
    sal number(7,2),
    mgr number(4),
    deptno number(2) );
    (2) 직접 dml을 수행할 수 없는 view
    create view emp_dept
    as select empno, ename, sal, emp.deptno, dname
    from emp, dept where emp.deptno=dept.deptno;
    [참고] 이 예에서 dept table의 deptno가 primary key나 unique로 선언되어 있
    다면 emp_dept view는 updatable join view가 되어 key-reserved table인 emp table
    에 대한 dml은 trigger를 사용하지 않아도 직접 수행 가능하다. <Bul:11642>참

    (3) instead of trigger
    view에 DML을 수행시 내부적으로 수행되기를 원하는 logic을 임의로 user가
    작성하면 된다.
    아래의 예에서는 emp_dept에 insert문장을 수행하는 경우 기존에 존재하는
    dept정보에 대해서는 update를 수행하고, 새로은 dept정보는 insert하도록 하였다.
    그리고 emp table에 대해서는 empno가 primary key이므로 중복되는 row는
    자동으로 오류가 발생하게 되며, 새로운 값을 insert하게 되면
    emp table에 직접 insert를 하게 된다.
    create or replace trigger emp_dept_insert
    instead of insert on emp_dept
    referencing new as n
    for each row
    declare
    dept_cnt number;
    begin
    if :n.empno is not null then
    insert into emp(empno, ename, sal)
    values (:n.empno, :n.ename, :n.sal);
    end if;
    if :n.deptno is not null then
    select count(*) into dept_cnt
    from dept where deptno = :n.deptno;
    if dept_cnt > 0 and (:n.dname is not null) then
    update dept set dname = :n.dname where deptno = :n.deptno;
    else insert into dept(deptno, dname) values(:n.deptno, :n.dname);
    end if;
    end if;
    end;
    (4) DML statement
    다음과 같이 insert 문장을 view에 수행하면 emp_dept_insert trigger가
    fire되어 실제 emp와 dept table에 반영이 되어 emp_dept view에 insert가
    수행된 것 같이 보이게 된다.
    insert into emp_dept values (5000, 'EYKIM', 100, 10, 'SALES');
    insert into emp_dept(empno, ename, deptno) values (6000, 'YOUNKIM', 20);
    insert into emp_dept (empno, deptno, dname) values (7000, 50, 'NEW_DEPT');

    No, the INSTEAD OF trigger is on the View, and so only fires if you perform Insert/Update/Delete on the View.

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

  • 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

  • How do I enable Instead of Trigger feature

    Tried compiling Intead of Trigger on my Oracle 8.1.5 server and got a feature not enabled error. is there a way to enable this feature without doing a re-install?
    R.

    Does your trigger already exist? If so, just reenable it, then recompile.
    EX. alter trigger jay_trg enable;
    alter trigger jay_trg compile;
    If your trigger doesn't already exist, and you're getting an "enable" error, I'm not sure. I just tried creating an instead-of trigger on a view, and it worked fine. The only roles granted to the user was connect and resource. Hope that helps.

  • [PLEASE] Prob with instead of Trigger  [URGENT !]

    Hi,
    I have an INSTEAD OF TRIGGER on a view which update 2 based tables.
    Each time the user update information,the system processes the update operation and insert a new row into the base tables.None of the based tables has any trigger.
    Why this insertion occures ? How can i stop it and update only the based tables without inserting the same row ?
    Thks for your advice
    lamine
    SQL> CREATE OR REPLACE TRIGGER UPDATE_PP_TR
    SQL>       INSTEAD OF UPDATE ON V_CONTACTS1_PP
    SQL>       FOR EACH ROW
    SQL>       begin
    SQL>         update ORGANIZATIONS
    SQL>         set
    SQL>           org_name = nvl(:new.org_name,org_name)
    SQL> .....
    SQL>           ,updated_by = v('USER')
    SQL>           ,updated_date = sysdate
    SQL>         where org_id = :new.org_id;
    SQL>         update INDIVIDUALS
    SQL>         set
    SQL>           ,gender = nvl(:new.gender,gender)
    SQL>           ,first_name = nvl(:new.first_name,first_name)
    SQL>           ,last_name = nvl(:new.last_name,last_name)
    SQL> ......
    SQL>           ,updated_by = v('USER')
    SQL>           ,updated_date = sysdate
    SQL>          where org_id = :new.org_id;
    SQL>        end UPDATE_PP_TR;

    Thks Andrew for your reply,
    The INSTEAD OF trigger doesn't insert new row as i said before.... apologies.... It processes 2 things:
    - update the field with the new value (what i want)
    - Replace any existing data that has the same reference_key by the new value.
    If we change the email of an individual and it happens that they are many people in the same company,then the INSTEAD OF TRIGGER updates the email and replace the other employees records by the one that has been updated.
    But if the company employes only 1 person then the process is ok.It's bizarre only for many employees in the same company.
    i.e:
    Martin Tom , [email protected], FRANCE SOFT
    Paul Henri, [email protected], FRANCE SOFT
    Jason Case, [email protected], FRANCE SOFT
    If i update Martin Tom's email to [email protected], Paul and Jason would be replace by Marin Tom's record....
    Martin Tom , [email protected], FRANCE SOFT
    Martin Tom , [email protected], FRANCE SOFT
    Martin Tom , [email protected], FRANCE SOFT
    Maybe my instead of trigger is written improperly.....
    Any advise ?

  • 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

  • Issue in Invoking an Updatable View with Instead of Trigger

    Hi,
    I am trying to insert a record using Updatable View with Instead of Trigger. When i try to save the data, i get the below error:
    java.sql.SQLException: ORA-01403: no data found
    ORA-06512: at line 1
    at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:457)
    at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:405)
    at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:889)
    at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:476)
    at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:204)
    at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:540)
    at oracle.jdbc.driver.T4CCallableStatement.doOall8(T4CCallableStatement.java:213)
    at oracle.jdbc.driver.T4CCallableStatement.executeForRows(T4CCallableStatement.java:1075)
    at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1466)
    at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3752)
    at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:3887)
    at oracle.jdbc.driver.OracleCallableStatement.executeUpdate(OracleCallableStatement.java:9323)
    at oracle.jdbc.driver.OraclePreparedStatementWrapper.executeUpdate(OraclePreparedStatementWrapper.java:1508)
    at weblogic.jdbc.wrapper.PreparedStatement.executeUpdate(PreparedStatement.java:172)
    at oracle.jbo.server.OracleSQLBuilderImpl.doEntityDML(OracleSQLBuilderImpl.java:432)
    at oracle.jbo.server.EntityImpl.doDMLWithLOBs(EntityImpl.java:8566)
    Can someone help me resolve this issue?
    Also it would be great if you can share Sample codes for Invoking an updatable view with instead of trigger on Save/commit.
    Regards,
    Jeevan

    As a trigger is executed in the db and not in your app it's really hard to help as you did not give any useful information.
    Have you read this blog http://stegemanoracle.blogspot.com/2006/03/using-updatable-views-with-adf.html ?
    Timo
    Edited by: Timo Hahn on 22.09.2011 09:15
    And my friend google also found http://technology.amis.nl/blog/1447/adf-business-components-resfresh-after-insertupdate-and-instead-of-triggers

Maybe you are looking for

  • Birthdays + Outlook + Calendar = Macro Needed!

    Would some wonderful soul out there write a quick little macro to get this job done? Outlook comes with a simple VB macro compiler, so all the macro would have to do would be to sort the calendar by annual events, then edit each of the listed contact

  • Unknown error occurred (-50) while Downloading a movie.

    When downloading The Hunger Games. The error (-50) happened. It also said "Please check that the connection to the network is active and try again". I've checked and everything is connected and fine but the same error still shows.

  • [Solved] Removing files with space in name.

    Hello! I have files named Feh wallpaper (exactly with space in name) and I was trying to remove it but i don't have any file manager and I remove files by rm. I was try rm -r feh_wallpaper and rm feh wallpaper and rm can't remove it Last edited by Sp

  • Project file in Google drive brings up error when saving

    I have been trying to work with my files in google drive so I can easily work from home/the office but quite often when I hit save, I get the error message "After Effects warning: Could not rename the file 'xxxxx\AEtemp-132584-projectname.aep' to 'pr

  • Install Xcode from Appstore. Shows "Installing. 3 minutes remaining."

    Hi, Trying to install Xcode (for iOS 7) from Appstore. Latest Mac OS X also is installed. Only Xcode shows "Installing. 3 minutes remaining." From then on, nothing happens. Any help please?