ApEx 4.1.1: update record in a view with 'instead of update' trigger

I created a form against a view. The view is complex enough which prevents direct updates. To incorporate the update logic I created an 'instead of update' trigger on the view. When I open up the form, do changes, and click 'Apply Changes' button I am getting the following exception
ORA-02014: cannot select FOR UPDATE from view with DISTINCT, GROUP BY, etc.
I understand that the standard 'Automatic Row Processing' process is trying to lock the record before updating using a cursor like
select *
from my_view
for update
and fails. Is it possible to bypass this locking while using the standard APEX processes?
I think I can create a custom PL/SQL process which would execute the UPDATE statement (at least, it works in SQL*Plus), but I would like to know if I can use a standard ApEx functionality for this.

Hello,
Sorry for delay.
I had found a feedback about trigger issue when restore SQL Database from a BACPAC file. Microsoft said the fixed  will be available in the next major release of DacFx.
Feedback:
SQL Azure fires a trigger when restoring from bacpac
You can refer to the workarounds in the feedback. For example, if there is small amount of triggers on the database, you can try to remove the triggers and then recreate when restore from bacpac file.
Regards,
Fanny Liu
Fanny Liu
TechNet Community Support

Similar Messages

  • 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

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

  • 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

  • BUG? VIEWS with INSTEAD OF triggers are updatable????

    When I try to update the view created with the PL/SQL code from
    below, with an infobus data form generated by JDev wizards , i
    ontain this error "ORA-22816: unsupported feature with RETURNING
    clause"
    Below this text are an plus80 sql text file, producing the same
    error and creating the database environment required.
    It creates :
    .-2 tables,
    .-2 sequences
    .-a joined view of this 2 tables
    .-an "instead of insert" trigger on the view
    Demostrating the correctness of this code there are a
    normal insert alone, and a pl/sql block producing the same kind
    error from plus80.
    If you generate the form to edit this view, it produces the same
    error when trying to do an insert, that the error produced by
    this sql file.
    --------------------------------------------cut here
    drop sequence suf_seq;
    CREATE SEQUENCE SUF_SEQ
    NOMAXVALUE
    NOMINVALUE
    NOCYCLE
    NOCACHE
    drop sequence fam_seq;
    CREATE SEQUENCE FAM_SEQ
    NOMAXVALUE
    NOMINVALUE
    NOCYCLE
    NOCACHE
    DROP TABLE SUBFAMILIAS CASCADE CONSTRAINTS;
    CREATE TABLE FAMILIAS
    (ID NUMBER(6,0) NOT NULL
    ,DESCRIPCION VARCHAR2(50) NOT NULL
    ,ACTIVO NUMBER(38)
    ,USERALTA VARCHAR2(15)
    ,FECHAALTA DATE
    ,USERMOD VARCHAR2(15)
    ,FECHAMOD DATE
    DROP TABLE FAMILIAS CASCADE CONSTRAINTS;
    CREATE TABLE SUBFAMILIAS
    (ID NUMBER(6,0) NOT NULL
    ,FAM_ID NUMBER(6,0)
    ,DESCRIPCION VARCHAR2(50) NOT NULL
    ,ACTIVO NUMBER(38)
    ,USERALTA VARCHAR2(15)
    ,FECHAALTA DATE
    ,USERMOD VARCHAR2(15)
    ,FECHAMOD DATE
    set serveroutput on;
    create or replace view test ( fam_id , suf_id , fam_descripcion
    ,suf_descripcion) as
    Select fam.id,suf.id,fam.descripcion,suf.descripcion
    from familias fam,subfamilias suf
    where fam.id=suf.fam_id;
    CREATE OR REPLACE TRIGGER test_insert
    INSTEAD OF INSERT
    ON test
    declare
    auxFam_Id familias.id%type;
    auxSuf_Id subfamilias.id%type;
    begin
    select fam_seq.nextval,suf_seq.nextval into
    auxFam_id,auxSuf_id from dual;
    insert into familias(id,descripcion) values
    (auxFam_id,:NEW.fam_descripcion);
    insert into subfamilias(id,fam_id,descripcion)
    values(auxSuf_Id,auxFam_id,:NEW.suf_descripcion);
    end;
    show errors;
    /* here is a non returning insert everything works ok */
    insert into test(fam_descripcion,suf_descripcion) values
    ('familia test 1','subfamilia test1');
    declare
    aux RowId;
    -- aux subfamilias.id%type;
    begin
    insert into test(fam_descripcion,suf_descripcion) values
    ('Familia test 2','Subfamilia test 2') returning RowId into aux;
    dbms_output.put_line(aux);
    --select * from subfamilias;
    --delete from subfamilias;
    end;
    -------------------------cut here
    null

    Are INSTEAD OF triggers the only way to insert/update
    information from a form using a view that combines
    fields from two different tables? My goal is to try
    to get away from using so many triggers and contain
    as much as I can within HTML DB. Is this really the
    only way?While you might be intimidated by the seeming complexity of an instead-of trigger, in the long run you'll be glad to dug in and did it the right way. The instead-of trigger is a thing of beauty where databases are concerned.
    One thing to be careful about: when you attach a trigger to a view and recompile the view, if it has 'CREATE OR REPLACE' in the definition, any triggers defined for the view will be lost. All your hard work creating that elegant trigger could be gone in a keystroke.
    Either use 'CREATE' without the 'OR REPLACE' or save a copy in your script repository or someplace safe so you can recreate it the event that it 'goes away' unexpectedly.
    As always, this is only my experience. Your mileage may vary. Perhaps you're smarter than me and have a nice trick you'd like to share for preserving such things in a more elegant way??
    Earl

  • Problem updating view with triggers

    I created a view with instead-of triggers for updating. When I try to update the view with an ADO 2.7 recordset I receive errormessages.
    rsAns.CursorLocation = adUseServer
    rsAns.Open "select * from callcenter.v_ans where kidno = 1534", adoConn, adOpenKeyset, adLockOptimistic
    rsAns.fields("Name").value = "Thomas"
    The last line creates the error:
    -2147217888
    Consumer's event handler called a non-reentrant method in the provider.
    When I try the same lines of code with...
    rsAns.CursorLocation = adUseClient
    I get:
    -2147217887
    Multiple-step operation generated errors. Check each status value.
    By the way, when using client side cursors with Microsoft's OLE DB for Oracle it works fine.
    Any ideas?

    I had the same problem but without triggers. I only changed some values in different records (always automatically commited) and after the third change I got this error message. At the same time I was connected with TOAD to the databse and there was no problem to change the data - so it doesn't look like a database problem.
    UPDATE "BLATABLE"."KEYS" SET "BLAVALUE" = "abcdef" WHERE ROWID = 'AAA2c1AADAAAHa5AAH' AND ORA_ROWSCN = '7738949481842'
    One error saving changes to table "BLATABLE"."KEYS":
    Row 6: ORA-01000: maximum open cursors exceeded

  • APEX time to insert update and/or records

    Hello everyone,
    I know how to get the time APEX needs to load a repor! But how can I get the time APEX took to insert, update and or delete a records!! Does this work with #TIMING# as well??? If it does where to put this...
    Thank you
    Regards
    Sebastian

    I use the APEX version 2.0.1 provided by the Oralce Database 10g XE!
    And I wanna know how long it takes to insert, update or delete a records???
    I may should add that I link the different buttons to the specific processes to running the approproated sql statements!
    When I use the debug mode as mentions there is no hit how long APEX took to insert, update or delete a records. It just shows the basic time values how long it takes to load the whole application.
    Regards
    Sebastian

  • How to update all condition records at a time with some percentage or some

    Dear Sir,
    In PRD system we have more than 600 condtion records.
    Noe desiel hikes happend, due to that client want to update all condition records(600) at a time with required percentage or required value.
    How to update all records at a time
    With regards
    Lakshmikanth

    Hi,
    Through BDC or LSMW first you have to do the recording for particular transaction code and then base on that u have to prepare the flat file to upload the file for the same.
    For BDC programing you have to take the help of ABAP progmer but LSMW you can also do.
    For more information about LSMW plz go to following link :
    [LSMW |http://www.slideshare.net/arun_bala1/sap-sd-lsmw-legacy-system-migration-workbench/]
    [Step-by-Step Guide for using LSMW|www.scmexpertonline.com/downloads/SCM_LSMW_StepsOnWeb.doc ]
    BDC
    [BDC Call Transaction|http://www.sapdevelopment.co.uk/bdc/bdc_ctcode.htm]
    [BDC Recording|http://www.sapdevelopment.co.uk/bdc/bdc_recording.htm]
    But it would be better for you to please contact to your ABAPer for BDC programming.
    Cheers...

  • Update trigger on table fr audit purpose to record column level information

    Hi,
    I want to create a update trigger which will record data in an audit table.
    In audit table I want to have columns like old_value_of_Col and new_value_of_Col.
    This is easily achievable. But my main concern is to add three more columns having the information of:
    1) Which column was updated?
    2) Old value of column that was updated
    3) New value of column that was updated
    If possible, Also if one updates three columns for example, then in such a case. I would like to have three entries in audit table for the corresponding three columns.
    Please help.
    Thanks in advance.

    A few approaches to consider.
    First, if you are on 11g, take a look at Flashback Data Archive: http://download.oracle.com/docs/cd/B28359_01/appdev.111/b28424/adfns_flashback.htm#ADFNS01011
    Second, you can use Fine-Grained Auditing to capture DML statements and bind variables. It is not as easy to reconstruct the before/after picture, but it may be sufficient for some purposes.
    For trigger-based solutions, I have seen the approach you propose (1 row for each column changed) and it is tedious and prone to maintenance headaches. You have to write code for each column, doing compares (remembering to consider NULLs), dealing with different datatypes, etc. We used that design becasue there was an actual requirement to produce a report that needed such a structure.
    An easier trigger-based solution is to create a history table for the table you want to track, with all of the columns from the original, plus whatever else you need for housekeeping. Write an After Insert/Update/Delete trigger on your base table, and populate/insert rows into the history table:
    - For inserts, populate and insert row from the :new. values
    - For deletes, populate and insert a row from the :old. values
    - For updates, popualte and insert a row from the :old. values and another from the :new. values
    I would also have a column to designate whether this is an Insert, Delete, Update-Old or Update-New row.
    Once you have done one example, the rest are easy. If you were sufficiently motivated (I have not yet been :-) ), you could probably write a script to query DBA_TAB_COLS and generate the code.

  • [Solved] How to update records in entity based on view with distinct

    Hi
    - I have a relational view of the form:
    SELECT DISTINCT
    FROM TAB1, TAB2, ...- I created instead of triggers for delete, update and insert.
    - I created an entity object on this and an updatable view object
    - I added this to my module.
    - Then I test the view object in the module (module > test), and if I try to update an existing record, I receive the error:
    (java.sql.SQLException) ORA-02014: cannot select FOR UPDATE from view with DISTINCT, GROUP BY, etc.
    So, ADF internally create as select FOR UPDATE cursor to update the modified record and as the error shows, this is not possible on a view with distinct, ...
    Is there a way to work around this error without to rewrite the view?
    I was thinking that there is maybe a way to force ADF not to use the select FOR UPDATE and use UPDATE .. SET <value> WHERE <pk>, or maybe to create a new instead of trigger to catch the select FOR UPDATE?

    Arti,
    Here's another solution (that will still use locking, and can help avoid the "lost update" problem):
    http://stegemanoracle.blogspot.com/2006/03/using-updatable-views-with-adf.html
    John

  • How to Highlight the CURRENT RECORD in a Table with Report Form

    Hi,
    I have created a Table with Report Form....let suppose the table is - EMP
    Report page - 1
    Form page - 2
    Now, when I do Create / Update on Page 2,....the control is back on Page1.
    Suppose in the Report Page (Page1)..we have 10 records....NOW how should I highlight the CURRENT RECORD in Page 1 with some color to identify the record which I have updated/created just now...
    Thanks,
    Deepak

    Hi Deepak,
    You could do that with a custom report template. I've done that here: [http://apex.oracle.com/pls/otn/f?p=267:175]
    Go to Shared Components, Templates and create a new Report template as a copy of your existing one. Then edit your template. In the above example, the Column Template 1 setting was:
    &lt;td #ALIGNMENT# headers="#COLUMN_HEADER#" class="t18data"&gt;#COLUMN_VALUE#&lt;/td&gt;I copied this into the Column Template 2 setting and updated the Column Template 1 setting to:
    &lt;td #ALIGNMENT# headers="#COLUMN_HEADER#" class="t18data" style="background-color:red; color:yellow;"&gt;#COLUMN_VALUE#&lt;/td&gt;I then set the Column Template 1 Condition to: Use Based on PL/SQL Expression
    and the Column Template 1 Expression to: '#EMPNO#' = '&P178_EMPNO.'
    (In my example, P178_EMPNO is the single item on the linked to page.
    Save those changes and go to your report and change its template to the new one. As long as a selection has been made and P178_EMPNO has a value, the condition will make sure that the report uses the first template for the row with the matching EMPNO value. All other rows get the template from Column Template 2.
    Andy

  • Updatable Materialized View with Union ALL

    (please don't ask about db structure)
    DB: 11gR2
    create table table_1  (
        id number primary key,
        val varchar2(100)
    create table table_2  (
        id number primary key,
        val varchar2(100)
    insert into table_1(id) values (0);
    insert into table_1(id) values (2);
    insert into table_1(id) values (3);
    insert into table_1(id) values (4);
    insert into table_1(id) values (5);
    insert into table_2(id) values (10);
    insert into table_2(id) values (12);
    insert into table_2(id) values (13);
    insert into table_2(id) values (14);
    insert into table_2(id) values (15);
    update table_1 set val='Table1 val:'||id;
    update table_2 set val='Table2 val:'||id;
    create view v_table_all as
    select * from table_1
    view V_TABLE_ALL created.
    select * from v_table_all;
    ID                     VAL                                                                                                 
    0                      Table1 val:0                                                                                        
    2                      Table1 val:2                                                                                        
    3                      Table1 val:3                                                                                        
    4                      Table1 val:4                                                                                        
    5                      Table1 val:5                                                                                        
    select column_name, updatable, insertable, deletable
    from user_updatable_columns
    where table_name = 'V_TABLE_ALL'
    COLUMN_NAME                    UPDATABLE INSERTABLE DELETABLE
    ID                             YES       YES        YES      
    VAL                            YES       YES        YES      
    update v_table_all set val='XXX changed' where id = 3;
    1 row updated.
    select * from table_1;
    ID                     VAL                                                                                                 
    0                      Table1 val:0                                                                                        
    2                      Table1 val:2                                                                                        
    3                      XXX changed                                                                                         
    4                      Table1 val:4                                                                                        
    5                      Table1 val:5                                                                                        
    rollback;
    select * from table_1;
    ID                     VAL                                                                                                 
    0                      Table1 val:0                                                                                        
    2                      Table1 val:2                                                                                        
    3                      Table1 val:3                                                                                        
    4                      Table1 val:4                                                                                        
    5                      Table1 val:5                                                                                        
    create or replace view v_table_all as
    select * from table_1
    union select * from table_2;
    view V_TABLE_ALL created.
    select * from v_table_all;
    ID                     VAL                                                                                                 
    0                      Table1 val:0                                                                                        
    2                      Table1 val:2                                                                                        
    3                      Table1 val:3                                                                                        
    4                      Table1 val:4                                                                                        
    5                      Table1 val:5                                                                                        
    10                     Table2 val:10                                                                                       
    12                     Table2 val:12                                                                                       
    13                     Table2 val:13                                                                                       
    14                     Table2 val:14                                                                                       
    15                     Table2 val:15  
    select column_name, updatable, insertable, deletable
    from user_updatable_columns
    where table_name = 'V_TABLE_ALL'
    COLUMN_NAME                    UPDATABLE INSERTABLE DELETABLE
    ID                             NO        NO         NO       
    VAL                            NO        NO         NO       
    trying update:
    update v_table_all set val='XXX changed' where id = 3;
    SQL-Fehler: ORA-01732: Datenmanipulationsoperation auf dieser View nicht zulässig
    01732. 00000 -  "data manipulation operation not legal on this view"
    *Cause:   
    *Action:
    drop view v_table_all;
    view V_TABLE_ALL dropped.all is ok before this point.
    now we want create a new materialized view with some query
    create  materialized view v_table_all
    as
    select * from table_1
    union all select * from table_2 ;
    materialized view V_TABLE_ALL created.
    select column_name, updatable, insertable, deletable
    from user_updatable_columns
    where table_name = 'V_TABLE_ALL'
    COLUMN_NAME                    UPDATABLE INSERTABLE DELETABLE
    ID                             YES       YES        YES      
    VAL                            YES       YES        YES       it seems to be ok with update.
    but...
    update v_table_all set val='XXX changed' where id = 3;
    SQL-Fehler: ORA-01732: Datenmanipulationsoperation auf dieser View nicht zulässig
    01732. 00000 -  "data manipulation operation not legal on this view"
    *Cause:   
    *Action:How can solve this issue??
    Any suggestion

    Looks like user_updatable_columns sort of thinks the MV is just a table - I don't know about that...
    An MV on a single table can be updated - I tried that and it works:
    create materialized view mv_table_1 for update
    as
    select * from table_1;I noticed [url http://download.oracle.com/docs/cd/E11882_01/server.112/e16579/advmv.htm#sthref294]examples stating the UNION ALL needs a "marker" so Oracle can know from the data which source table a row in the MV originates from - like this:
    create materialized view v_table_all for update
    as
    select 'T1' tab_id, table_1.* from table_1
    union all
    select 'T2' tab_id, table_2.* from table_2 ;But that also fails (the "marker" requirement was specifically for FAST REFRESH, so it was just a long shot ;-) )
    What are you planning to do?
    <li>Create the MV.
    <li>Update records in the MV - which then is no longer consistent with the source data.
    <li>Schedule a complete refresh once in a while - thereby overwriting/losing the updates in the MV.
    If that is the case, I suggest using a true table rather than an MV.
    <li>Create table t_table_all as select ... .
    <li>Update records in the table - which then is no longer consistent with the source data.
    <li>Schedule a job to delete table and insert into table select ... once in a while - thereby overwriting/losing the updates in the table.
    In other words a kind of "do it yourself MV".
    I cannot see another way at the moment? But perhaps try in the data warehousing forum - the people there may have greater experience with MV's ;-)

  • Can any one please send me an update trigger (pl/sql procedure) for ap tables(ap_suppliers,ap_supplier_site_all,and contacts)

    Please send an query for update trigger for those tables .
         1: ap_suppliers
         2: ap_supplier_sites_all
         3: ap_supplier_contacts.
    Thanks,
    Chaitanya.

    Hi,
    Actually ID and Data are different names in my API. Here I mentioned like that.
    Am using Oracle 10g version.
    Yes I am going to get the multiple values using this Ref Cursor. The same ref cursor is used in another API of my package.
    In this API, the user actually enters Application_id and data. API should insert/update the version_master table with the inputs. See application_id is the foriegn key for app_master table.
    The requirement is whenever they enters application_id and data, if application_id already present in the version_master table, then the data should be updated and we should get a status flag for this using Out variable(i.e. using ref cursor only we are showing the status). if the application_id is not present in the version_master table, new record should be inserted. The sequence will generate the version_id for version_master table.
    But the Merge statement is working fine for update and insert also. Problem is am unable to see the success or failure through ref cursor. I don't know how exactly I can use this.
    If data is NULL the operation should be failed. i.e. I should get Failure status here. But am not getting this.
    Please remove the comments here and then check. If I use the NVL2 function I was able to get the status flag, i.e. S or F.
    OPEN resultset_o FOR
    SELECT NVL2 (data, 'S', 'F')
    FROM version_master
    WHERE application_id = application_id_i;
    1.How the value of data being not null will determine Success of the api and how null failure
    2.If the above select statement goes in to exception when others how I will no the failure
    I have to achieve the above scenarios.
    Please advice me.

  • How to insert record in child table with foreign key

    Hi,
    I am using Jdeveloper 11.1.2.0. I have two master table one child table.
    How to insert and update a record in child table with foreign key ?
    I have created VO based on three EO(one eo is updatable other two eo are references) by using joined query.
    Thanks in Advance
    Edited by: 890233 on Dec 24, 2011 10:40 PM

    ... And here is the example to insert using sequenceimpl by getting the primary key of the master record and insert master and detail together.
    Re: Unable to insert a new row with a sequence generated column id
    -Arun

Maybe you are looking for

  • HP Omni second Monitor

    I purchased a new Dell Monitor to hook up to my OMni as well as a VGA tu USB cable, how do I set up dual monitors?

  • Need Help regarding payroll ASAP

    Hi Friends.. i m new to hr-abap and i have installed IDES in my system. i want to know Can we work out on payroll and Time management programs with IDES data for practice or anything extra need to configure?? Please guide me as i need to start practi

  • Multiple language

    Hi! How can i display two langauges in report, english and urdu? in forms two languages are displaying but in reports urdu character are not displaying correctly my clent character set is MSWIN1252 thanks

  • Line Graph Hyperlink

    Does anybody know if you can create a hyperlink on a Line Graph? I would like the user to click on the data markers and pass parameters to another report based on those values. Thanks in advance

  • Data miss match

    HI sdn Gurus,can anybody share with me some real time issues related to data miss match in support project.i am in need of it.i just want to know that what are the issue did comes related to data miss match in production & support environment.