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

Similar Messages

  • 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

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

  • How to create ADF BC components like EO from  "View with INSTEAD OF trigger

    I have a "View with INSTEAD OF trigger" on a external schema. is it possible to create ADF EO on top of this view in my local schema?. If possible, then is it possible to insert/update that external table using ADF standard data controls and Application module?. I'm trying to see if it's possible with standard ADF controls without calling pl/sql API to insert/update that external table. any ideas are appreciated.
    Regards,
    Surya

    http://stegemanoracle.wordpress.com/2006/03/15/using-updatable-views-with-adf/

  • 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

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

  • ADF BC: Creating updatable VO based upon DB View with "instead of" trigger

    Hello all,
    I have got an interesting issue. I have an Oracle DB view that is used to hide some complexity in the underlying DB design (it does some unions). This view is updatable because we have created an "instead of" update trigger to update the correct table when a row is updated. This is working fine in SQL.
    Next, we have created an ADF Entity object based upon the view, specifying an appropriate PK for the DB View. Then, we have created an updatable VO based upon the EO. All well and good so far. The issue we have is in trying to commit changes to the DB - because the ADF BC framework is trying to lock the row to update (using SELECT ... FOR UPDATE), it's not working because of ORA-02014 - cannot select FOR UPDATE from view with DISTINCT, GROUP BY, etc.
    This leads me to thinking about overridding doSelect() on the EO as hinted here http://radio.weblogs.com/0118231/stories/2005/07/28/differenceBetweenViewObjectSelectAndEntityDoselectMethod.html
    As a temporary test, we have over-ridden the EO's doSelect to call super.doSelect(false) and it does work, although we will have lost update issues as detailed in Steve's article.
    My questions:
    1). Is overriding doSelect() the correct thing here? Perhaps there is a better way of handling this problem? I do have a base EO class from which all of the EO's extend, so adding this behavior should be straightforward.
    2). Does anyone have example doSelect implementation? I am thinking of overriding doSelect for my EO and calling super.doSelect (lock=false), but then I need to deal with some possible exceptions, no?
    Kind regards,
    John

    Hi John,
    I have exactly the same issue as you experienced back in January. I have a complex data modelling requirement which requires the need to pivot rows into columns using ROW_NUMBER() and PARTITION clauses. To hide the complexity from the middle tier, I have created a database view and appropriate INSTEAD OF triggers and mapped my EO to the view. I have overriden the lock() method on the EO implementation class (to avoid ORA-02014) and would like to try the same solution you used with the pl/sql call to lock the record.
    My question is, how did you manage the release of the lock if the transaction was not rolled back or committed by your application i.e. if the user closed the browser for instance.
    In my naivity, I would like to think that the BC4J framework would release any locks for the database session when it found the servlet session to be terminated however my concern is that the lock would persist and cause complications.
    Any assistance greatly appreciated (if you would be willing to supply your lock() method and pl/sql procedure logic I would be even more grateful!).
    Many thanks,
    Dave
    London

  • View with Instead of Trigger - ORA-01031

    I am having trouble with a form based on a view that uses an instead of trigger.
    When I attempt to update a complex view that uses instead of triggers in an APEX form, I get the following message:
    ORA-20001: Error in DML: p_rowid=21388, ... ORA-01031: insufficient privileges
    The view works correctly when updates are executed from SQL Plus.
    The view "VW" is based on several tables in the application schema "X", which is parsed by APEX, and several tables in another schema "Z". I have explicitly granted select permission on the tables in schema "Z" to schema "X", but this doesn't resolve the error.
    Any idea how to fix this problem? From reading other posts, it sounds like the only issue should be explicit grants on the tables in other schemas. I do not attempt to update the tables in schema "Z", and do not have update permissions to those tables.
    Sinerely, Justin

    Justin,
    you might try to grant the views to the FLOWS_xxxxx user, which performs the Apex processes.
    Dik Dral

  • Big Problem with Instead Of Trigger

    I have following problem: I created my own user-table where I want to store some
    attributes like user-foto etc... This table I join with the HTMLDB
    wwv_flow_fnd_user (I gave myself the select grant on it) in a view
    On the view I created an INSTEAD-OF-Trigger for DELETE-Operations where I delete
    only my user-table. But when I execute it it gives me an
    ORA-01031: insufficient privileges
    I can not understand it.
    <pre>
    ===========================================================
    SQL*Plus: Release 10.2.0.1.0 - Production on Tue Sep 27 05:28:13 2005
    Copyright (c) 1982, 2005, Oracle. All rights reserved.
    Connected to:
    Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
    With the Partitioning, OLAP and Data Mining options
    SQL> DROP TABLE my_users
    2 ;
    Table dropped.
    SQL> CREATE TABLE my_users AS
    2 SELECT user_id
    3 FROM flows_020000.wwv_flow_fnd_user
    4 ;
    Table created.
    SQL> ALTER TABLE my_users ADD my_attr VARCHAR2(10);
    Table altered.
    SQL> ALTER TABLE my_users ADD CONSTRAINT pk_my_users PRIMARY KEY( user_id );
    Table altered.
    SQL> CREATE OR REPLACE VIEW v_my_users
    2 AS
    3 SELECT u2.user_id,
    4 u.user_name,
    5 u.first_name,
    6 u.last_name,
    7 u2.my_attr
    8 FROM flows_020000.wwv_flow_fnd_user u,
    9 my_users u2
    10 WHERE u2.user_id = u.user_id
    11 ;
    View created.
    SQL> CREATE OR REPLACE TRIGGER trg_del_v_my_users
    2 INSTEAD OF DELETE ON v_my_users
    3 FOR EACH ROW
    4 BEGIN
    5 DELETE my_users
    6 WHERE user_id = :OLD.user_id
    7 ;
    8 END;
    9 /
    Trigger created.
    SQL> DELETE v_my_users WHERE 1=2
    2 ;
    DELETE v_my_users WHERE 1=2
    ERROR at line 1:
    ORA-01031: insufficient privileges
    ===========================================================
    </pre>
    And: If there is no PK on table my_users I got not error!
    Can anybody explain it?
    And: How can I include my listings in the forum with courier font?

    Is the primary key in this table referencing any table(s) in other schema? How should this work?
    Look at the script above:
    ALTER TABLE my_users ADD CONSTRAINT pk_my_users PRIMARY KEY( user_id );
    Bye,
    Rumburak

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

  • View with instead of trigger still not updatable

    Hi everybody,
    could somebody explain how to make this view updatable?
    I have the following log:
    CREATE OR REPLACE FORCE VIEW BRS_V_VERPLICHTINGEN
    (VERPLICHTING_NR
    ,ONTSTAANSJAAR
    ,OMSCHRIJVING
    ,DATUM_VERANTWOORDING
    ,OBJECT_NR
    ,OBJECT_NAAM
    ,CDG_CODE
    ,TMA_CODE
    ,CREATED_BY
    ,CREATION_DATE
    ,LAST_UPDATED_BY
    ,LAST_UPDATE_DATE)
    AS SELECT vw_brs_verplichting.verplichting_nr
    ,     vw_brs_verplichting.ontstaansjaar
    ,     nvl( brs_verplichtingen.omschrijving, vw_brs_verplichting.verplichting_oms
    ,     vw_brs_verplichting.datum_verantwoording
    ,     vw_brs_verplichting.object_nr
    ,     vw_brs_verplichting.object_naam
    , brs_verplichtingen.cdg_code
    ,     brs_verplichtingen.tma_code
    ,     brs_verplichtingen.created_by
    ,     brs_verplichtingen.creation_date
    ,     brs_verplichtingen.last_updated_by
    ,     brs_verplichtingen.last_update_date
    FROM vw_brs_verplichting
    ,     brs_verplichtingen
    WHERE vw_brs_verplichting.vervallen_code = 'N'
    AND vw_brs_verplichting.verplichting_nr = brs_verplichtingen.verplichting_nr
    AND vw_brs_verplichting.ontstaansjaar = brs_verplichtingen.ontstaansjaar
    View created
    CREATE OR REPLACE TRIGGER BRS_VVG_IRU
    INSTEAD OF UPDATE
    ON BRS_V_VERPLICHTINGEN
    BEGIN
    brs_vvg_pck.instead_of_row_update( :new.verplichting_nr
    , :new.ontstaansjaar
    , :new.omschrijving
    , :new.cdg_code
    , :new.tma_code
    END ;
    Trigger created
    SELECT COLUMN_NAME
    ,     INSERTABLE
    ,     UPDATABLE
    ,     DELETABLE
    FROM USER_UPDATABLE_COLUMNS
    WHERE TABLE_NAME = 'BRS_V_VERPLICHTINGEN'
    COLUMN_NAME INSERTABLE UPDATABLE DELETABLE
    VERPLICHTING_NR YES YES YES
    ONTSTAANSJAAR YES YES YES
    OMSCHRIJVING NO NO NO
    DATUM_VERANTWOORDING YES YES YES
    OBJECT_NR YES YES YES
    OBJECT_NAAM NO YES NO
    CDG_CODE NO YES NO
    TMA_CODE NO YES NO
    CREATED_BY NO YES NO
    CREATION_DATE NO YES NO
    LAST_UPDATED_BY NO YES NO
    LAST_UPDATE_DATE NO YES NO
    12 rows selected
    But that one column still isn't updatable... however because i'm using an INSTEAD OF UDPATE trigger they should all be updatable, shouldn't they?
    I'm using the 10g database...
    Hope someone can help...
    Regards,
    Robert

    Justin,
    you might try to grant the views to the FLOWS_xxxxx user, which performs the Apex processes.
    Dik Dral

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

  • Issues with the Custom Filter in Datasheet View

    I'm seeing some odd, yet intermittent, behavior while trying to filter columns in datasheet view using a custom filter. After clicking to apply a filter to a column and choosing 'Custom Filter...' a pop-up with regular expressions should appear much like
    the following screenshot:
    However sometimes, usually on a page refresh, this pops up instead:
    I have been able to replicate this sporadically in both IE 8 and 9 against different columns but it's really inconsistent. I can't seem to find any configuration issues or commonality across the clients that might be responsible. Local installations of Office
    are 32bit. I know 64bit has been known to cause some issues. I wanted to see if anyone else has run into this issue at all or perhaps it has been addressed in a more recent CU than what I am running (14.0.6117.5002). Any insight would be much appreciated,
    thanks in advance.

    Hello all
    We get this as well on one computer in the office. It seems to be more of an MS Office issue than a Sharepoint issue specifically the "Microsoft Office List 14.0" ActiveX add in.
    On one computer that has Office 2010, when "Edit in Datasheet" is clicked within a Sharepoint list the MS office list 14 ActiveX is called and the custom filter options appear with the missing combo boxes like in the picture at the top. I've found this is
    reproducible by simply doing:
    1.  Visit a Sharepoint list
    2. Actions > Edit in Datasheet
    (If you click one of the drop downs at this point and choose Custom filter it will open as expected)
    3. Actions > Show in standard view
    4. Actions > Edit in Datasheet
    5. Click one of the drop downs, choose Custom filter and the problem will occur
    The only way to make the option reappear is to close down IE and reopen it. You'll then get one more go with point 1 and 2 above before the problem will reoccur again after changing the view using Actions.
    Anyone using Office 2007 doesn't seem to have this problem however this uses a different version of the control namely "Microsoft Office List 12.0"
    Uninstalling Office 2010 and reinstalling it seems to fix it for a bit but the problem will soon come back. Strangely it won't come back straight away but when it does its easy to reproduce following the above steps.
    Testing this on another computer that just happens to have Office 2010 and Sharepoint Designer 2007 installed the problem does not occur however when the ActiveX is called for the Sharepoint list it just happens to invoke the Office List 12 version despite
    the fact both versions are available on the machine.
    This probably happens because Sharepoint Designer was installed after Office 2010 was installed on the machine so has updated the registry to call the older version which seems to be problem free.
    ActiveX files
    Microsoft Office List 12.0 = C:\Program Files\Microsoft Office\Office12\STSLIST.DLL
    Microsoft Office List 14.0 = C:\Program Files\Microsoft Office\Office14\STSLIST.DLL
    Version 14.0.6015.1000 - came with Office 2010 with SP1
    I've tried patching version 14.0 STSLIST.dll to:
    14.0.6130.5000 (KB2589349)
    14.0.6137.5000
    (KB2760804) - 9th April 2013 and is the newest I could find at the time.
    Edit as I'm typing this: Just found http://support.microsoft.com/kb/2817403 which is dated 11th June 2013 but doesn't mention any fix for this problem.
    I've tried installing the Sharepoint services support components using the Sharepoint Designer installer package as below:
    This includes the STSLIST.dll version 12.0 and updates the registry accordingly so that this component is referenced and does seem to fix the problem.
    Unfortunately for me, when I checked back later the browser had reverted back to using the 14.0 component for reason I can't explain. Perhaps a Windows update came through and "adjusted" the registry settings to use the newer version. Unfortunately any attempt
    at deleting the 14.0 file simply recreates it when "Edit in Datasheet" is choosen.
    It would be great to get a proper fix for this instead of having to try and force the computer to use the older component!

  • Issue with fast refresh on a materialized view

    Hi,
    Oracle DB version is 10.2.0.3
    We have a matierialized view created using this script. We have materialized view logs on these six tables.
    By default, it is set to ON COMMIT .
    When a batch job is run every morning (usually 100-200 records) we set it to ON DEMAND and then bring it back to ON COMMIT. It takes around 1-2 minutes.
    If the batch is unusually big, like say 100,000 it takes more than 5 hours to put it back on ON COMMIT. (We analyze the schema (GATHER STALE) before refreshing the MV.) Trace shows deletes taking a long time.
    When I see a big batch, I usually drop the view and recreate it with indexes (there is also a context index). Takes 30 mins to do the whole thing.
    I tried refreshing it COMPLETE when the num of rows is high but it still takes more than 2 hours..(I killed it)
    Is there any way to speed things up without dropping and recreating the MV ?
    thanks
    Mat view creation script:
    CREATE MATERIALIZED VIEW WCC_INTERNAL_SEARCH_M
    TABLESPACE ICV_TS_WCC_DATA
    NOCACHE
    LOGGING
    NOCOMPRESS
    NOPARALLEL
    BUILD IMMEDIATE
    REFRESH FAST ON COMMIT
    WITH ROWID
    AS
    SELECT orgname.ROWID orgname_rowid,
    cnt.ROWID cnt_rowid,
    locgrp.ROWID locgrp_rowid,
    cntry.ROWID cdcntry_rowid,
    addrgrp.ROWID addrgrp_rowid,
    addr.ROWID addr_rowid,
    cnt.cont_id cont_id,
    decode(cntry.name,'US',substr(addr.postal_code,1,5),addr.postal_code) postal_code,
    cntry.name country,
    UPPER(addr.addr_line_one) addr_line_one,
    UPPER(addr.addr_line_two) addr_line_two,
    UPPER(addr.addr_line_three) addr_line_three,
    UPPER(addr.CITY_NAME) city_name,
    UPPER(cnt.CONTACT_NAME) display_name,
    UPPER(orgname.ORG_NAME) org_name,
    addr.prov_state_tp_cd
    FROM orgname,
    contact cnt,
    locationgroup locgrp,
    cdcountrytp cntry,
    addressgroup addrgrp,
    address addr
    WHERE locgrp.cont_id = orgname.cont_id
    AND locgrp.cont_id = cnt.cont_id
    AND addrgrp.location_group_id = locgrp.location_group_id
    AND addr.country_tp_cd = cntry.country_tp_cd
    AND addr.address_id = addrgrp.address_id
    AND cnt.INACTIVATED_DT is null
    AND locgrp.END_DT is null
    AND orgname.END_DT is null
    AND cnt.person_org_code = 'O'
    AND cntry.lang_tp_cd = 100
    AND locgrp.member_ind = 'Y'
    AND locgrp.loc_group_tp_code = 'A'
    ORDER by org_name,city_name,postal_code,country;

    This is the script that creates the preferences and then the context index.
    exec ctx_ddl.create_preference('STEM_FUZZY_PREF', 'BASIC_WORDLIST');
    exec ctx_ddl.set_attribute('STEM_FUZZY_PREF','FUZZY_MATCH','AUTO');
    exec ctx_ddl.set_attribute('STEM_FUZZY_PREF','FUZZY_SCORE','60');
    exec ctx_ddl.set_attribute('STEM_FUZZY_PREF','FUZZY_NUMRESULTS','100');
    exec ctx_ddl.set_attribute('STEM_FUZZY_PREF','STEMMER','AUTO');
    exec ctx_ddl.set_attribute('STEM_FUZZY_PREF', 'wildcard_maxterms',15000) ;
    exec ctx_ddl.create_preference('LEXTER_PREF', 'BASIC_LEXER');
    exec ctx_ddl.set_attribute('LEXTER_PREF','index_stems', 'ENGLISH');
    exec ctx_ddl.set_attribute('LEXTER_PREF','skipjoins',',''."+/-&');
    exec ctx_ddl.create_preference('ICV_WCC_INT_SEARCH_CTX_PREF', 'BASIC_STORAGE');
    exec ctx_ddl.set_attribute('ICV_WCC_INT_SEARCH_CTX_PREF', 'I_TABLE_CLAUSE','tablespace ICV_TS_CTX_IDX');
    exec ctx_ddl.set_attribute('ICV_WCC_INT_SEARCH_CTX_PREF', 'K_TABLE_CLAUSE','tablespace ICV_TS_CTX_IDX');
    exec ctx_ddl.set_attribute('ICV_WCC_INT_SEARCH_CTX_PREF', 'N_TABLE_CLAUSE','tablespace ICV_TS_CTX_IDX');
    exec ctx_ddl.set_attribute('ICV_WCC_INT_SEARCH_CTX_PREF', 'I_INDEX_CLAUSE','tablespace ICV_TS_CTX_IDX compress 2');
    exec ctx_ddl.set_attribute('ICV_WCC_INT_SEARCH_CTX_PREF', 'P_TABLE_CLAUSE','tablespace ICV_TS_CTX_IDX');
    exec ctx_ddl.set_attribute('ICV_WCC_INT_SEARCH_CTX_PREF', 'R_TABLE_CLAUSE','tablespace ICV_TS_CTX_IDX');
    CREATE INDEX WCC_INT_SEARCH_CTX_I1 ON WCC_INTERNAL_SEARCH_M
    (ORG_NAME)
    INDEXTYPE IS CTXSYS.CTXCAT
    PARAMETERS('Wordlist STEM_FUZZY_PREF
    LEXER LEXTER_PREF
    STORAGE ICV_WCC_INT_SEARCH_CTX_PREF');
    DB is 10.2.0.3

Maybe you are looking for

  • Help needed on creating a SAP query

    Hi All, Can somebody give me the step by step procedures of creating a SAP query and Infoset. My requirement is to display asset master details with Asset number or Asset class as input. Any pointers or links to create an infoset and query will br hi

  • Trying to add a value to REG_NONE in the Registry

    I'm trying to add a value to the Windows Registry with key type of REG_NONE. I looked here, among other places, and it was no help: http://superuser.com/questions/331811/how-to-create-registry-key-of-type-reg-none Here's the command I am using: reg a

  • Table level refresh in oracle from prod to test or development database

    Hi, one interviewer asked me the below question, what is the best answer. suggestions appreciated. 1.How did you deal with that situation?Consider if you have a repeated requirement to "refresh" just 30 tables in a particular schema from a production

  • Easy replacement of a source datastore

    Hi gurus, Is there an easy way to replace a source datastore by another one with the same structure in an interface ? Without having to re-do the join, filter and the mapping of target column. Thanks for your help. Regards

  • Java Plugin does not initialize

    Hi, I am trying to run a web based tool called Infoview through firefox and it involves java plugin, but when I try to create a new report in InfoView using firefox browser it says no suitable plugins found. I do not know how to fix this. Currently I