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 ?

Similar Messages

  • INSTEAD OF trigger on view to update a table. error in 4.2apex tabular rpt

    I have created a view (LANDINGS_VIEW') that I am hoping to use to add/modify data over several tables. I am using INSTEAD OF trigger to update/insert into the underlying tables. I am receiving the error:
    •ORA-01858: a non-numeric character was found where a numeric was expected ORA-06512: at "SAFIS.LANDINGS_V_IO_UPD_TRG", line 4 ORA-04088: error during execution of trigger 'SAFIS.LANDINGS_V_IO_UPD_TRG' (Row 1)I am only setting PRICE = 300.
    any thoughts? Am I setting this up propertly? thanks for your help!!
    Karen
    The LANDING_VIEW is set up as follows:
    -- Start of DDL Script for View SAFIS.LANDINGS_VIEW
    -- Generated 03-May-2013 10:25:38 from [email protected]
    CREATE OR REPLACE VIEW landings_view (
       landing_seq,
       dealer_rpt_id,
       unit_measure,
       reported_quantity,
       landed_pounds,
       dollars,
       disposition_code,
       grade_code,
       species_itis,
       market_code,
       price,
       area_fished,
       sub_area_fished,
       lease_num,
       gear_code,
       de,
       ue,
       dc,
       uc,
       local_area_code,
       fins_attached,
       explanation,
       late_report,
       modified_data,
       nature_of_sale,
       hms_area_code,
       sale_price,
       deleted )
    AS
    select l.LANDING_SEQ,
           l.DEALER_RPT_ID,
           l.UNIT_MEASURE,
           l.REPORTED_QUANTITY,
           l.LANDED_POUNDS,
           l.DOLLARS,
           l.DISPOSITION_CODE,
           l.GRADE_CODE,
           l.SPECIES_ITIS,
           l.MARKET_CODE,
           l.PRICE,
           l.AREA_FISHED,
           l.SUB_AREA_FISHED,
           l.LEASE_NUM,
           l.GEAR_CODE,
           l.DE,
           l.UE,
           l.DC,
           l.UC,
           l.LOCAL_AREA_CODE,
           a.fins_attached,
           a.explanation,
           a.late_report,
           a.modified_data,
           a.nature_of_sale,
           a.hms_area_code,
           a.sale_price,
           a.deleted
      from landings l,
           landings_hms a
      where  l.dealer_rpt_id = v('P110_DEALER_RPT_ID') and
            l.dealer_rpt_id = a.dealer_rpt_id(+) and
            l.landing_seq = a.landing_seq(+)
    -- Triggers for LANDINGS_VIEW
    CREATE OR REPLACE TRIGGER landings_v_io_upd_trg
    INSTEAD OF
      UPDATE
    ON landings_view
    REFERENCING NEW AS NEW OLD AS OLD
    DECLARE
       v_first_day   date;
       BEGIN
    update landings set landing_seq = :old.landing_seq,
                              dealer_rpt_id = :old.dealer_rpt_id,
                              unit_measure = :new.unit_measure,
                              reported_quantity = :new.reported_quantity,  
                            --  landed_pounds = :new.landed_pounds,
                              dollars = :new.dollars,
                              disposition_code= :new.disposition_code, 
                              grade_code = :new.grade_code,
                              species_itis =  :new.species_itis,
                               market_code = :new.market_code,
                              price =  :new.price,
                              area_fished = :new.area_fished,
                              sub_area_fished = :new.sub_area_fished,
                           --   lease_num = :new.lease_num,
                              gear_code = :new.gear_code,
                              de = :new.de,
                              ue = :new.ue,
                              dc = :new.ue,
                              uc = :new.uc,
                              local_area_code =  :new.local_area_code ;     
        /*  update landings_hms  set dealer_rpt_id = :old.dealer_rpt_id,
                                 landing_seq = :old.landing_seq,
                                 fins_attached = :new.fins_attached,
                                 explanation = :new.explanation,
                                 late_report = :new.late_report,
                                 modified_data = :new.modified_data,
                                 nature_of_sale = :new.nature_of_sale,
                                 hms_area_code = :new.hms_area_code,
                                 sale_price = :new.sale_price,
                                 de = sysdate,
                                 ue = :new.ue,
                                 dc = :new.dc,
                                 uc = :new.uc ;                         
    end;
    -- End of DDL Script for Trigger SAFIS.LANDINGS_KEH_V_IO_TRG
    CREATE OR REPLACE TRIGGER landings_v_io_trg
    INSTEAD OF
      INSERT
    ON landings_view
    REFERENCING NEW AS NEW OLD AS OLD
    DECLARE
       v_first_day   date;
       BEGIN
    insert into landings_keh (landing_seq,
                              dealer_rpt_id,
                              unit_measure,
                              reported_quantity,
                              landed_pounds,
                              dollars,
                              disposition_code,
                              grade_code,
                              species_itis,
                              market_code,
                              price,
                              area_fished,
                              sub_area_fished,
                              lease_num,
                              gear_code,
                              de,
                              ue,
                              dc,
                              uc,
                              local_area_code)      
       values ( landings_seq.NEXTVAL,
                :new.dealer_rpt_id,
                :new.unit_measure,
                :new.reported_quantity,
                :new.landed_pounds,
                :new.dollars,
                :new.disposition_code,
                :new.grade_code,
                :new.species_itis,
                :new.market_code,
                :new.price,
                :new.area_fished,
                :new.sub_area_fished,
                :new.lease_num,
                :new.gear_code,
                sysdate,
                :new.ue,
                :new.dc,
                :new.uc,
                :new.local_area_code)  ;
       insert into landings_hms (dealer_rpt_id,
                                 landing_seq,
                                 fins_attached,
                                 explanation,
                                 late_report,
                                 modified_data,
                                 nature_of_sale,
                                 hms_area_code,
                                 sale_price,
                                 de,
                                 ue,
                                 dc,
                                 uc,
                                 deleted)
           values (:new.dealer_rpt_id,
                   landings_seq.CURRVAL,
                   :new.fins_attached,
                   :new.explanation,
                   :new.late_report,
                   :new.modified_data,
                   :new.nature_of_sale,
                   :new.hms_area_code,
                   :new.sale_price,
                   sysdate,
                   :new.ue,
                   :new.dc,
                   :new.uc,
                   :new.deleted);
    end;
    -- End of DDL Script for Trigger SAFIS.LANDINGS_KEH_V_IO_TRG
    -- End of DDL Script for View SAFIS.LANDINGS_VIEWbtw, I have succefully run the following update in sqlplus.
    update landings set landing_seq = 8604583,
    dealer_rpt_id = 2660038,
    unit_measure = 'LB',
    reported_quantity = 3,
    -- landed_pounds = :new.landed_pounds,
    dollars = 900,
    disposition_code= '001',
    grade_code = '10',
    species_itis = '160200',
    market_code = 'UN',
    price = 30,
    area_fished = null,
    sub_area_fished =null,
    -- lease_num = :new.lease_num,
    gear_code = '050',
    de = sysdate,
    ue = 'keh',
    dc = null,
    uc = 'keh',
    local_area_code = null
    where landing_seq = 8604583; I am using apex 4.2
    Edited by: KarenH on May 3, 2013 10:29 AM
    Edited by: KarenH on May 3, 2013 10:31 AM
    Edited by: KarenH on May 3, 2013 11:04 AM
    Edited by: KarenH on May 3, 2013 4:09 PM

    could it be so simple?
    when I created the tabular form on my view, LANDINGS_VIEW, the APPLYmru was automatically generated, referencing the view name LANDINGS_VIEW. I modified that to indicate the table name (LANDINGS). I am not certain why that would work, but it seems to so far.
    this post was helpful: Re: instead of trigger on view
    I am now testing to make certain both the underlying tables can be updated, LANDINGS and LANDINGS_HMS

  • Instead of trigger on view with CLOB data

    I have writed Instead of trigger for view "article(id,text)" with CLOB
    field "text".
    create or replace trigger v_article_insert
    instead of insert on v_article
    for each row
    declare
    begin
    insert into article(id,text) values(id,:new.text);
    end v_article_insert;
    When I try to do DML (insert, update), forexample:
    insert into v_article(text) values('bla-bla')
    I get:
    ORA-25008 no implicit conversion to LOB datatype in instead-of trigger.
    ( Cause: When inserting or updating a view using instead-of trigger, the
    new value for a LOB view column is of a different datatype.
    Action: Specified a LOB value as the new value for the LOB view
    column.)
    insert into v_article(text) values(empty_clob()) - It works...
    What does it mean and what is right syntax for DML for CLOB fields in
    instead of triggers?

    When inserting CLOBs you create the row with an Empty_Clob() to initialize the CLOB field. Then you can update the empty CLOB with your CLOB value.
    The error message is telling you that Oracle will not convert your CLOB to the initialization value needed.

  • 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

  • Instead of trigger on view

    I created a view to use in a tabular form and only need to update one column from one table of that view. How do I write the instead of trigger to accomplish this? The field that I am trying to update is a select list-yes/no column in the tabular form. Upon submit with the wizard MRU and the instead of trigger I wrote the update doesn't take effect.
    Without the trigger I get this error:
    ORA-01445: cannot select ROWID from, or sample, a join view without a key-preserved tableHere's the 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)
    /Here's the trigger I created
    CREATE TRIGGER 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
    END;As always, TIA!
    Alexandra
    Edited by: userRRRYB on Jul 11, 2011 4:16 PM - ADDED VIEW

    Alexandra,
    You're going to get that error when creating a tabular form off of a complex view because of the validations APEX creates for you, not because of your trigger. Delete those validations and try again.
    Of course, you're going to want to add the where clause to your trigger, or you'll find that you're updating many more rows than you want...
    -David

  • Need help with INSTEAD OF trigger on view

    Hi,
    I am trying to use INSTEAD OF on a view because I will be updating the calling table in my trigger, which will cause mutation. 
    I need to update attribute7 of another record based on the new attribute7 of the current record (record being updated in the form).  Below is my script.  My problem is it does not perform the update. 
    create or replace view xxont_oe_order_lines_vw as select * from oe_order_lines_all;
    CREATE OR REPLACE TRIGGER APPS.xxont_sync_ard
    instead of insert or update on xxont_oe_order_lines_vw
    referencing
    new as new
    old as old
    for each row
    begin
       update oe_order_lines_all
           set attribute7 = :new.attribute7
       where attribute18 = to_char(:new.header_id)
          and attribute17 = to_char(:new.line_id)
          and flow_status_code <> 'CANCELLED' ;      
      /*exception
      when others then
         null ;
      end ;*/        
    end ;

    Always make your code developer friendly. Do extensive code instrumentation. At lease you can do this.
    create or replace trigger apps.xxont_sync_ard
    instead of insert or update on xxont_oe_order_lines_vw
    referencing
    new as new
    old as old
    for each row
    declare
       zero_update exception;
    begin
       update oe_order_lines_all
          set attribute7 = :new.attribute7
        where attribute18 = to_char(:new.header_id)
          and attribute17 = to_char(:new.line_id)
          and flow_status_code <> 'CANCELLED' ;
       if sql%rowcount = 0 then
         raise zero_update;
       end if;
    exception
      when zero_update then
         raise_application_error
               -20001
             , 'OE_ORDER_LINES_ALL: 0 rows updated attribute18 = "'
               || attribute18
               || '" attribute17 = "'
               || to_char(:new.line_id)
               || '"'
    end ;
    This will help you raise error when the update does not update any row. This is just an example, make sure if this is what your requirement wants if you want to implement it. If you don't want to raise error then you can just log it in a log table or log file.

  • Issue with Instead of Trigger

    Hi everyone,
    I have a view v_test . Created one instead of trigger over it. When I try to insert over the view it is throwing an error like' ORA-00036: maximum number of recursive SQL levels (50) exceeded' . Please help me how to over come from this.
    Please find the below DDL Stmts;
    CREATE TABLE test (id NUMBER,
    name VARCHAR2(10 CHAR),
    sal NUMBER,
    dept_id NUMBER);
    CREATE OR REPLACE VIEW v_test
    IS
    SELECT * FROM test;
    Trigger Code:
    CREATE OR REPLACE TRIGGER TR_V_TEST
    INSTEAD OF INSERT ON V_test
    FOR EACH ROW
    BEGIN
    INSERT INTO V_test VALUES(107,'VEERA',20000,30);
    END;
    Thanks in Advance !!
    Thanks,
    Vissu....

    Vissu,
    One and main scenario of mutating table error is depicted by your code only. You have created instead of Insert Trigger on view, within which again you are trying to insert on the same view i.e. you are trying to perform DML on a view which is already under transition state.
    Actually, Oracle tries hard to do the task. No of attempts is the value specified for "session_cached_cursors" (which is 50 here), but fails finally to recognise the table/view state, so throws the exception ORA-00036.
    In your case, instead of trigger was not required. You must understand the purpose of Instead of triggers. They are used when Multiple Tables build a view, and a DML on the view required data insertion in multiple tables. In above case, only one table is involved, so instead of trigger is not required. DML on your view can insert only in TEST table.
    But in above case, handle this by avoiding the DML(Insert) on the view inside the instead of insert trigger.
    Your purpose by insert on the view is to insert into TEST table only. So inside Instead of trigger,you can directly insert into table.
    Hope it is clear now !!

  • 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

  • Insert order by records into a view with a instead of trigger

    Hi all,
    I have this DML query:
    INSERT INTO table_view t (a,
                              b,
                              c,
                              d,
                              e)
          SELECT   a,
                   b,
                   c,
                   d,
                   e
            FROM   table_name
        ORDER BY   dtable_view is a view with an INSTEAD OF trigger and table_name is a table with my records to be inserted.
    I need the ORDER BY clause because in my trigger i call a procedure who treat each record and insert into a table, used in the view. I need to garantee these order.
    If i put an other SELECT statement outside, like this:
    INSERT INTO table_view t (a,
                              b,
                              c,
                              d,
                              e)
          SELECT   a,
                   b,
                   c,
                   d,
                   e
            FROM   table_name
        ORDER BY   dIt works. But I can put these new SELECT because these query is created automatic by Oracle Data Integrator.
    What I'm asking you is if there any solution to this problem without changing anything in the Oracle Data Integrator. Or, in other words, if there is any simple solution other than to add a new SELECT statement.
    Thanks in advance,
    Regards.

    Sorry... copy+paste error :)
    INSERT INTO table_view t (a,
                              b,
                              c,
                              d,
                              e)
        SELECT   *
          FROM   (  SELECT   a,
                             b,
                             c,
                             d,
                             e
                      FROM   table_name
                  ORDER BY   d)I need to insert him by a D column order, because my trigger needs to validate each record and insert him. I have some restrictions. For example, my records are:
    2     1     2006     M
    1     2     2007 M
    1     3     2007     S 2007
    1     2     2007     S 2007
    2     1     2009     S
    2     1     2009     S
    I want to insert the 'M' records first and then the 'S' records because the 'S' records only makes sense in target table is exists 'M' records
    Regards,
    Filipe Almeida

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

  • View, instead of trigger and ORA-01031

    Hello,
    I have a view based on outer joins like
    CREATE VIEW vt ( colV1, colV2, colV3, colV4, colV5, colV6, colV7, colV8 ) AS
    SELECT A.colA1, A.colA2, C.colB0, B.colB2, B.colB3, B.colB4, C.colC2, H.colH2
      FROM  tabA    A
           ,tabB    B
           ,tabC    C
           ,( SELECT  ...
                FROM   tabD  D
                      ,tabE  E
                WHERE  D.colD1 = E.colE1
             )  H                                
      WHERE A.colA1 = B.colB1
        AND LTRIM(B.colB2,'A') = LTRIM(C.colC1(+),'A')    
        AND B.colB3 = H.colH1(+); and an instead of trigger
    CREATE OR REPLACE TRIGGER vt_upd
      INSTEAD OF UPDATE ON vt
    BEGIN
      UPDATE    tabB
         SET    colB4 = :NEW.colV6
         WHERE  colB0 = :NEW.colV2;
    END;An now the problem: an update statement UPDATE vt set colV6=1 WHERE colV1=1; in SQL*Plus works as it should, but performing an update in APEX from a tabular or edit form shows an error: ORA-01031:ORA-01031: insufficient privileges, update...The strange thing: in both sessions there is the same user USER1 logged on !
    Why this difference ? Can anybody explain ?
    Regards,
    Heinz

    Hi Heinz,
    Your statement -
    what I wrote as table tabC in reality is a view to one table and one view in another schema.That'll be it, you need to grant explicit rights for the objects in that schema to the schema that is your parsing schema for your workspace.
    In other words, if you have -
    1) Workspace 'A' with parsing schema 'B'
    and you are trying to do -
    select foo from c.bar
    i.e. you're trying to query an object in schema 'C'.
    Then you need to (as a DBA or connected to schema C) -
    grant select on bar to b;Roles won't work (when used through APEX)...I can't say that any other way, you might find it works in SQLPlus with roles, but through APEX it won't...you need those explicit grants.
    Hope this makes sense.
    John.

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

  • BULK INSERT into View w/ Instead Of Trigger - DML ERROR LOGGING Issue

    Oracle 10.2.0.4
    I cannot figure out why I cannot get bulk insert errors to aggregate and allow the insert to continue when bulk inserting into a view with an Instead of Trigger. Whether I use LOG ERRORS clause or I use SQL%BULK_EXCEPTIONS, the insert works until it hits the first exception and then exits.
    Here's what I'm doing:
    1. I'm bulk inserting into a view with an Instead of Trigger on it that performs the actual updating on the underlying table. This table is a child table with a foreign key constraint to a reference table containing the primary key. In the Instead of Trigger, it attempts to insert a record into the child table and I get the following exception: +5:37:55 ORA-02291: integrity constraint (FK_TEST_TABLE) violated - parent key not found+, which is expected, but the error should be logged in the table and the rest of the inserts should complete. Instead the bulk insert exits.
    2. If I change this to bulk insert into the underlying table directly, it works, all errors get put into the error logging table and the insert completes all non-exception records.
    Here's the "test" procedure I created to test my scenario:
    View: V_TEST_TABLE
    Underlying Table: TEST_TABLE
    PROCEDURE BulkTest
    IS
    TYPE remDataType IS TABLE of v_TEST_TABLE%ROWTYPE INDEX BY BINARY_INTEGER;
    varRemData remDataType;
    begin
    select /*+ DRIVING_SITE(r)*/ *
    BULK COLLECT INTO varRemData
    from TEST_TABLE@REMOTE_LINK
    where effectiveday < to_date('06/16/2012 04','mm/dd/yyyy hh24')
    and terminationday > to_date('06/14/2012 04','mm/dd/yyyy hh24');
    BEGIN
    FORALL idx IN varRemData.FIRST .. varRemData.LAST
    INSERT INTO v_TEST_TABLE VALUES varRemData(idx) LOG ERRORS INTO dbcompare.ERR$_TEST_TABLE ('INSERT') REJECT LIMIT UNLIMITED;
    EXCEPTION WHEN others THEN
    DBMS_OUTPUT.put_line('ErrorCode: '||SQLCODE);
    END;
    COMMIT;
    end;
    I've reviewed Oracle's documentation on both DML logging tools and neither has any restrictions (at least that I can see) that would prevent this from working correctly.
    Any help would be appreciated....
    Thanks,
    Steve

    Thanks, obviously this is my first post, I'm desperate to figure out why this won't work....
    This code I sent is only a test proc to try and troubleshoot the issue, the others with the debug statement is only to capture the insert failing and not aggregating the errors, that won't be in the real proc.....
    Thanks,
    Steve

Maybe you are looking for

  • Goods issue problem

    sir, we have prepare the p.o. regarding purchase of tea/coffe powder at the time of receipt migo following entry passed in a/c doc Inv-consumable  DR xxx     To gr/ir                                xxx at the time of miro gr/ir a/c           Dr   xxx

  • Organize scanned pictures without a certain date

    I already read a similar thread, which I couldn't post in, as it was archived. Since iPhoto is designed for digital pictures, we all assume to create and manage our libraries by using digitally taken pictures. I am somehow enough "young" to have the

  • Mail is freezing

    Ever since I installed Maverick, Mail has been acting strange. Hundreds of old email messages are re-downloaded (mostly from my Gmail account) and I can't quit the Mail application; it freezes. I have to force my laptop to shutdown.

  • Field addition

    How to know if ane new fields are added matl. master ? In our system some new field were added, we need to know how many new fiels are added like this ? pl help guru

  • Setting the maximum number of rows in a ResultSet

    Hi everybody, Anyone knows if it is possible to set the maximum number of rows to obtain in a ResultSet using JDBC 2.0, and if so, how to do it? Thanks in advance.