Workaround for ORA-02060: update on view with db-link

Hello,
In my application I have a page that is based on a view. This view itself is based on a table in the same database and a table in another database which I pick up through a db-link.
To update the data in the view I have created an instead-of trigger which handles all the DML (which is a direct update on the local table and a message towards a broker for the update of the remote database).
When updating from the database with a statement like UPDATE VIEW SET COLUMN1 = VALUE WHERE COLUMN2 = PK_ID, there is no problem. Everything is triggered in the right way.
But when I want to update a row in my APEX page I get 'ORA-02060: select for update specified a join of distributed tables'. This is due to the fact that APEX fetches the row as SELECT * FROM VIEW FOR UPDATE.
How can I work around this? I don't need the locking mechanism that 'FOR UPDATE' provides, because I can solve that myself. So basically, can I alter APEX's statement that performs the Automatic Row Processing (DML)?

So you answered your question yourself :) Pretty or not, it does the work. Imagine programmers beeing able to work only using wizards and have no clue about what they do. What kind of quality would you get? :)
Denes Kubicek
http://deneskubicek.blogspot.com/
http://www.opal-consulting.de/training
http://apex.oracle.com/pls/otn/f?p=31517:1
-------------------------------------------------------------------

Similar Messages

  • Updatable View issues:  cannot select FOR UPDATE from view with DI

    Hi All,
    I have a simple view XY and an instead of trigger on that to insert data into one table which is used in the my view. When I do insert statement on view XY it is working fine from sql but when i used same thing with page process of " Process Row of XY Automatic Row Processing (DML) " i am getting following error. I am using APEX 3.0 . Please help me.
    ORA-20001: Error in DML: p_rowid=xxxx, p_alt_rowid=abc, p_rowid2=, p_alt_rowid2=. ORA-02014: cannot select FOR UPDATE from view with DISTINCT, GROUP BY, etc.
    Thanks

    James,
    are you already on 3.0.1.00.07 or 3.0.1.00.08? Have a look at the release notes, it says something about a bug fix for some occurrences of ORA-02014.
    Also have a look at the new substitution value/item FSP_DML_LOCK_ROW which turns locking off if you set it to FALSE. See http://www.oracle.com/technology/products/database/application_express/html/3.0.1_readme.html#CHDIDIAF and also http://download-west.oracle.com/docs/cd/B32472_01/doc/appdev.300/b32471/advnc.htm#BCGFDAIJ
    Patrick
    My APEX Blog: http://inside-apex.blogspot.com
    The ApexLib Framework: http://apexlib.sourceforge.net
    The APEX Builder Plugin: http://apexplugin.sourceforge.net/ New!

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

  • Workaround for ORA-04030 error

    hi,
    we've encountered the following error:
    ORA-04030: out of process memory when trying to allocate 296 bytes (callheap, koposal dvoid)
    all of the research i've done points to setting up the database with a Very Large Memory configuration, which will be carried out at a later date as we're still in the development stage.
    is there a possible workaround for this error?
    thanks
    santosh sewlal

    hi,
    we're inserting into tables - spatial data and images, from a C#.net application that sends data to the db in a BLOB

  • How do I update a view with a join

    I have a module with database block based on a view with joins, so I am not able to perform insert, update & delete directly.
    Therefore I created an unbound item that can be changed. The relevant database record is searched and updated.
    So, with above work around, insert, update & delete is possible.
    This works just fine.
    Now, the 'save icon' in the menu (diskette icon), does not get activated automatically when there are changes to be saved. This is because the view is not changed.
    So, I enable the 'save icon' manually in the when-validate-item trigger. But now when I navigate to another record, the 'save icon' gets de-activated by QMS/headstart code. This is because the view is not changed.
    So, I tried set_record_property (CHANGED_STATUS) to let the application
    know there are changes to be saved.
    But then, I get an error:
    * FRM-40654: Record has been updated by another user. Re-query block to see
    change.
    What is the proper way to handle this problem?
    null

    Peter,
    I think you've gone down the wrong track with your workaround.
    You should base your form on the view and allow update and insert to the view just as if it was a table.
    If you are using Oracle 8i, create an INSTEAD-OF trigger on the view in the database which redirects the DML to insert or update the appropriate table(s) instead of the view.
    If you are pre Oracle 8i, in the form you can create on-insert, on-update, and on-delete triggers to redirect the DML to the appropriate table.
    The only other tricky situation comes if you have items in your form that are server-derived (in the TAPI) of the table(s) in question. If so, you must explicitly code the form to retrieve these server-derived values. Also note that with a view, you cannot have a server derived primary key since there would be no way to retrieve it in the form. (Views don't have a rowid.) You must derive primary key columns in the form when the form is based on the view.
    Regards,
    Lauri

  • Need to add a new View With ITS Link in it

    Hello All ,
      I am Working on SAP CRM 7.0 in Marketing here in marketing We do have an Account Work Center here in account we have three views Search , Create and Report .I want to add a new view with name "XYZ" in this view i want have Logical links . This logical link is ITS (Transaction Launcher ). Can any one Tell me the Procedure for this . Thanks in Advance
    regards,
    KiranPosanapalli

    Solved by myself

  • Update emial address with confirmation link

    Hi,
    I am using registration process like this one, described at Mr Schenk web:
    http://www.guenter-schenk.com/tutorials/tutorial.php?id=1
    There is e-mail adress, used in registration process  to activate account  by clicking a link.
    I am going to give  a possibility to change(update) that email address in user profile but in safe way. For example with additional  password checking and email sending to the new address with confirmation  link which should by clicked to make change.
    Is there any simple method implemented in Developer Toolbox? Maybe I should use 'send email' trigger with content which include earlier preapered url (confirmation link) ?
    Thanks in advance.

    Heya,
    Use an insert record form with send email trigger. I would have another db table for "new address" with fields for user_id(foreign key based off session variable), new_email, random_key, email_confirmed that passes users id and new_email to the table and generates a random key. Then send email SB to new address. In content of send email have a generated URL of confirmation_page.php?URL parameter of random key&URL parameter of new_email&URL parameter for user_id.
    In confirmation_page have MySQL update "new address" table for email_confirmed field where URL parameter for random key && URL parameter for new_email == table fields in "new address" database. Have it write over any other record in the table based off query where user_id in table == user_id from URL parameter && URL parameter random_key && new_email so any "old, new email addresses" for the user will be overwritten in the database. Then place a MySQL update table where email_confirmed is set on "new address" table to update "users" table for new email address based on foreign key user_id.
    This is not really something that is entirely available out of box from ADDT. You would have to use a combination of insert record SB+send email+ MySQL hand coding. The explanation should give you enough to go on if you know some code.
    Good luck!

  • Is there another update after 10.1.0.273 for the Z10? I assume we'll be notified as for the first update... Any Link update?

    Just wondering if there is an update for the Z10 beyond the 10.1.0.273...  I have been reading about a so-called "leaked" one on CrackBerry forums but not being a real experimenter with these gadgets I would not download it for sure...
    I assume we'd be notified as we were before, with the last one.
    This user is happy with the device and has much more to learn about it, but it takes time.
    I would still advocate for further info that should come with the phone, either the flyer or on the phone menu such as "expect ........  [hours, minutes?] to update your software when an official update is announced"   -- it takes longer than you expect.  And more detailed info as to how to do it, via WiFi only or Data Services....
    What about the Link software, has that been updated?   I am not expecting it, but was just wondering...

    For official updates, you'll be notified in the same manner.
    For now, what you have is the latest update.
    1. If any post helps you please click the below the post(s) that helped you.
    2. Please resolve your thread by marking the post "Solution?" which solved it for you!
    3. Install free BlackBerry Protect today for backups of contacts and data.
    4. Guide to Unlocking your BlackBerry & Unlock Codes
    Join our BBM Channels (Beta)
    BlackBerry Support Forums Channel
    PIN: C0001B7B4   Display/Scan Bar Code
    Knowledge Base Updates
    PIN: C0005A9AA   Display/Scan Bar Code

  • Bug: updating a view with a CLOB column results in ORA-01461

    Here is a database script to create a table and a view:
    CREATE TABLE TEST_CLOB(ID NUMBER, TEXT CLOB);
    CREATE OR REPLACE VIEW VTEST_CLOB AS
    SELECT ID, TEXT FROM
        SELECT ID, TEXT
        FROM TEST_CLOB
        WHERE ID IN (SELECT 1 FROM DUAL)
    The following code throws ORA-01461: can bind a LONG value only for insert into a LONG column.
    static void Main()
         using (var conn = new OracleConnection(ConnectionString))
              conn.Open();
              var trans = conn.BeginTransaction();
              var cmd = conn.CreateCommand();
              cmd.BindByName = true;
              var p = new OracleParameter("vText", new string('a', 4001));
              cmd.Parameters.Add(p);
              cmd.CommandText = "UPDATE vTEST_ClOB set TEXT = :vText";
              cmd.ExecuteNonQuery();
              trans.Rollback();
    Please create a table and a view exactly as shown above.
    The error doesn't happen when updating TEST_CLOB table itself or if the view is created as follows:
    CREATE OR REPLACE VIEW VTEST_CLOB AS
    SELECT ID, TEXT FROM
        SELECT ID, TEXT
        FROM TEST_CLOB
        WHERE ID IN (1)
    This code was tested with ODP.NET version 4.112.3.0 and ODP.NET Managed Beta2 version 4.112.3.60.
    Oracle 11g Release 11.2.0.2.0 64-bit.
    When constructing OracleParameter like this: var p = new OracleParameter(name, stringValue), OracleDbType property is always set to OracleDbType.Varchar2,
    but I think it should take into accout the size of the stringValue and change it to OracleDbType.Clob automatically.

    I've noticed similar behavior with byte arrays.
    Parameters with byte[] data longer than 4000 bytes are treated as RAW or LONG RAW type values (not sure which one exactly).
    Explicitly setting parameter type to OracleDbType.Blob works around this problem.
    Also, it's very strange that these errors don't seem to occur on tables, only views are affected.
    Any thoughts on this please?

  • Workaround for ORA-14551 WHILE CALLING FUNCTION IN SQL OVER DBLINK

    Hi,
    any idea how to workaround such issue in 9.2.0.8 (I know this is working with 11.2).
    create table mylog(id number, data date , mess clob);
    create or replace function myfunc(id in number, data in date ,mess in varchar2)
    return number is
    pragma autonomous_transaction;
    retval number;
    begin
       insert into mylog values (id , data ,mess);
    commit;
    retval := id;
    return retval;
    end;
    SQL> select schema.myfunc@dblink(2,sysdate,'bbbbbbb') from dual;
    ERROR at line 1:
    ORA-14551: cannot perform a DML operation inside a query
    ORA-06512: at "SCHEMA.MYFUNC", line 6
    ORA-06512: at line 1Regards
    GregG

    DBMS_SQL is documented in what I think 9i calls "Supplied Oracle Packages and Types" manual.
    The basic concept behind this is that it allows you to manually create a cursor and execute it (via an OCI like interface). For example, it can be used to issue remote DDLs via a database link as described in {message:id=10323373}.
    DBMS_SQL provides flexibility and power that is beyond the standard cursor constructs in PL/SQL. The system package version even enables you to execute SQL and PL/SQL code as any other schema in the database.
    You will have however to play around with DBMS_SQL (locally and remotely) to determine how to hide the fact that a local select (which Oracle assumes, correctly, does not change database state), actually changes the state of a remote database.
    Personally I would not bother with such a hack. I would use the problem to enforce an upgrade to the latest Oracle version, or kick out the crappy app that needs to use a SQL select to make database changes.

  • PL/SQL Exception for ORA-00942 - Table or view not found?

    Hey there!
    I want to create an exception my code runs into whenever it tries to select from a table that is not existent (or because of insufficient privileges).
    How can I get these ORA-00942 errors and place them into a exception? Except for WHEN OTHERS, that's not concrete enough.
    Regards,
    Thomas

    SQL> DECLARE
      2   table_not_found EXCEPTION;
      3   PRAGMA EXCEPTION_INIT(table_not_found, -942);
      4  BEGIN
      5   EXECUTE IMMEDIATE 'SELECT COUNT(*) FROM DUALX';
      6  EXCEPTION
      7   WHEN table_not_found
      8   THEN
      9      dbms_output.put_line('Table NOT found');
    10  END;
    11  /
    Table NOT found

  • Workaround for slow performance and poor resolution with RED R3D files in After Effects CC 2014 (13.0)

    http://blogs.adobe.com/aftereffects/2014/06/red-r3d-problems-after-effects-cc-2014-13-0.ht ml
    The After Effects team are investigating a bug in After Effects CC 2104 (13.0) where RED (.R3D) files are very slow and the image resolution is poor, about 1/8 sampling.
    The following workaround has been reported to solve the problems in some cases:
    Save the project.
    Choose Edit > Purge > All Memory & Disk Cache.
    Please post in this thread about whether or not this workaround helped you.

    Intentionally cross-linking threads: this issue was first reported in this thread, which has an ongoing discussion:
    AE 2014CC RED R3D files support broken - footages looks bad, everything slow.
    The thread you are in now is the comment thread for the blog post. Please post in whichever thread makes more sense for you. I am monitoring both.

  • Need workaround for continued failed update?

    I haven't been able to get Dreamweaver to successfully update for quite some time. There's no detail to the error message, just a generic statement that it didn't complete the process. Screen capture below. What's my next step?

    Have you tried downloading the update manually and then installing it manually?  The download link is this one:
    <http://download.macromedia.com/pub/dreamweaver/updates/cs5/11_0_4/win/AdobeDreamweaver-11- 0-All-Update.zip>
    You may need to restart your machine after you have applied the updates for changes to take place.
    hth

  • Confirm an account and then update a view with the results of customer hist

    Hello Everyone,
    I have a question and was wondering if someone can help.
    In IC Webclient, in a B2B scenario, I change the framework so that when it tries to call BuPaIbaseSearch view, calls instead IRecHistory.
    My intention is that when we need to identify an account, we show the views BuPaSearchB2B and the IRecHistory, side-by-side. OK.
    When we confirm an acount, I need to display the last five interaction records in the IRecHistory view.
    The problem is that when I confirm an acount (at BuPaSearchB2B), this view (IRecHistory) changes his buttons layout, but doesn't fill the table with the data. When if I go to somewhere else, no matter what entry in my navigation bar, and then return, the table is now filled.
    How can I fill this table, right after the confirmation of an account? Maybe a refresh of the IRecHistory view?? How can I manage that?
    Can somebody give me hints?
    Best regards
    Bruno Garcia

    I am not sure to understand what you are explaining. As far as I understand you have two frames and when you change somehing in one and you go to the other passing a table the last one does not get the values but when you return you have the table fill.
    Well, I am also working with frames and I have had the same problems with the attributes. Sometimes it was because they were "Auto", and other it was because the page was stateless instead of statefull. I am not sure enough as to explain you what is the rigth combination so I suggest you to try.
    Good luck.
    -- Oscar --

  • Discoverer 4i Plus returns no data when using views with db link references

    I am using Discoverer 41 Plus to view reports online.
    When I create a worksheet based on a view, that only references local tables, everything is OK and Disco plus shows the output OK.
    When I create a worksheet based on a view, that references a Database link, Disco plus gives me an "Query caused no data to be returned" error.
    Is this to be expected from Discoverer Plus?
    Thanks - Sue.

    I'm wondering if this has anything to do with the default position (and default aggregate) for the EUL folder item? I can see that some of the folders have number type items with default position 'Data Point' and others have these with default position of 'Top or Side'. I'm totally stabbing around in the dark here; looking at EUL folders which exhibit the problem and those which don't.
    I've tried changing one field to 'Data Point' and it hasn't helped. Will try changing the join items now I think.
    If anyone has any comments, would be v. grateful as I'm looking at dropping folders which have quite a bit of code around them and trying to re-create them exactly, which is a risky and horrible solution.

Maybe you are looking for

  • A1 -- Google Talk (chat) does not work for me

    I have not been able to get Google Talk to work on my A1 tablet since I got it.  The tablet does almost everything I want it to and I've been able to figure out and fix all the bugs so far except for Google Talk. When I try to start the app, I immedi

  • How do I create a new document window with JS

    I would like to create a new window for an open document  modify the duplicate document, export and close leaving the original document in it's original state. Is there a way to do this with Jave script? If I were to do this manually I would go to th

  • Jw player pop up ads

    I've noticed the last couple weeks this ad player was in background playing videos now it is in forefront and it is driving me crazy! I've reset Firefox, I've deleted and reinstalled but all the info for my bookmarks and things are still here even th

  • How to get unmatched songs on my iPhone after running Match

    A small percentage of my songs have been included in Match. I've subscribed for over a year.   More than half the songs in my library have no cloud status (so it's not that they are definitively NOT available for Match). I click on the Update Match i

  • Conversion of Informix functions to Oracle

    Hi, Can anyone help me in the conversion of the following informix functions to Oracle dtcvasc() rftmtdate() deccvasc() rdefmtdate() dttoasc() rtoday() These functions exists in ESQL/c(informix). Please help in converting the aboue functions to oracl