Update primary key with a tabular form based on a select list for each row

Hello!
I've two tables: Table1 with only one column (primary key) is a foreign key for table2.column1 (primary key). There is also a second primary key column in table2.
Now I want to change the primary key values in table2.column1 with a tabular form (MRU) based on a select list (LOV based on table1.column1) for each row.
The user should be able to choose for every row a new value from the select list to change the old primary key value at this position.
How can I do this with ApEx?
I've the tabular form and so on, but at the moment I get the following error:
"Error in mru internal routine: ORA-20001: Fehler in MRU: row= 1, ORA-20001: ORA-20001: Die aktuelle Version der Daten in der Datenbank wurde geändert, seit der Benutzer einen Update-Prozess eingeleitet hat. ..."
Thank you for your support!
Kay

Hello!
I've two tables: Table1 with only one column (primary key) is a foreign key for table2.column1 (primary key). There is also a second primary key column in table2.
Now I want to change the primary key values in table2.column1 with a tabular form (MRU) based on a select list (LOV based on table1.column1) for each row.
The user should be able to choose for every row a new value from the select list to change the old primary key value at this position.
How can I do this with ApEx?
I've the tabular form and so on, but at the moment I get the following error:
"Error in mru internal routine: ORA-20001: Fehler in MRU: row= 1, ORA-20001: ORA-20001: Die aktuelle Version der Daten in der Datenbank wurde geändert, seit der Benutzer einen Update-Prozess eingeleitet hat. ..."
Thank you for your support!
Kay

Similar Messages

  • Updating primary key with jdbc

    Trying to update a primary key with:
    public static void updateTAXID(String coid,String accountnumber,String oldTAXID,String fundname,String newTAXID){ Properties props = TradeHelper.loadProperties(); Connection conn = null; PreparedStatement st = null; String sql ="update FinancialAccount set taxid=? " + "where dealernumber=? and " + "taxid=? and " + "fundname=? and " + "accountnumber=?"; try{ Class.forName(props.getProperty("driver")); conn = DriverManager.getConnection(props.getProperty("brokerageurl"), props.getProperty("user"),props.getProperty("password")); st = conn.prepareStatement(sql); st.setString(1, newTAXID); st.setString(2, coid); st.setString(3, oldTAXID); st.setString(4, fundname); st.setString(5, accountnumber); st.executeUpdate(); System.out.println("Update: new tx:"+newTAXID+":"+"Ol tx: "+oldTAXID+" act:"+accountnumber); conn.close(); st.close(); }catch(Exception e){ e.printStackTrace(); } }
    I keep getting this error:
    com.mysql.jdbc.exceptions.MySQLIntegrityConstraintViolationException: Duplicate entry '02673025561-QA-SLFCA-' for key 'PRIMARY'         at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1011)         at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956)         at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3491)         at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3423)         at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1936)         at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2060)         at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2542)         at com.mysql.jdbc.PreparedStatement.exe
    Am I not able to update a single field of a composit key with jdbc? Whay is my update failing telling that there is a duplicate when I am trying to update?

    iketurner wrote:
    I keep getting this error:
    com.mysql.jdbc.exceptions.MySQLIntegrityConstraintViolationException: Duplicate entry '02673025561-QA-SLFCA-' for key 'PRIMARY'
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1011)
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956)
    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3491)
    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3423)
    at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1936)
    at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2060)
    at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2542)
    at com.mysql.jdbc.PreparedStatement.exeAm I not able to update a single field of a composit key with jdbc? Whay is my update failing telling that there is a duplicate when I am trying to update?If you take the error message at its word then the problem is not that you are not permitted to update a primary key but that the values you are trying to use is already in use.
    I'll leave it you DBA and/or Data Modeler/Architech to decide if it is a good idea to update the value or not.

  • Using a custom PL/SQL to populate the primary key in a tabular form

    I want to use a Custom PL/SQL Function to populate the primary key when I insert a new record into a tabular form. I want to get the value from a hidden page Item. The code I am using for the primary key source is:
    BEGIN
    INSERT INTO TEAM_MEMBERS(TEAM_ID)
    VALUES(:P75_TEAM_ID);
    END;
    When I try to insert a new record I get the following error:
    Error      ERR-1904 Unable to compute item default: type = Function Body computation_type= BEGIN INSERT INTO TEAM_MEMBERS(TEAM_ID) VALUES(:P75_TEAM_ID); END; .
    ORA-06550: line 5, column 2: PLS-00103: Encountered the symbol ";" when expecting one of the following: begin case declare end exception exit for goto if loop mod null pragma raise return select update while with << close current delete fetch lock insert open rollback savepoint set sql execute commit forall merge pipe The symbol "exit" was substit
    Any ideas what I am doing wrong?
    Thanks!

    Brian - Sometimes whitespace at the end of the block causes this. Be sure to trim everything after the last semicolon including tabs and newlines.
    Scott

  • Tabular form loses data on validation check and new row

    When you add new rows inside a tabular form and you have a validation which troughs out an error then all data inside the new rows are lost.
    Is there any workaround available?
    Tobias
    Edited by: Tobias Arnhold on Jun 29, 2012 12:48 PM
    I forgot to tell:
    Current version of APEX 4.0.2
    I also get this firebug error: uncaught exception: Syntax error, unrecognized expression: #
    Somebody else had this issue before too: APEX 4.0  Tabular Form - Javascript error due to validation
    Is there any workaround available?

    Yeah, you cannot validate on tabular forms so you pretty much have to find work-arounds in order to validate your information. When you create an LOV you can create it with a dynamic query which is the basis for your select list. You can just modify the query in the dynamic query to include a where clause. The where clause could then just state 'where EMP_ID2 <> EMP_ID1'. That way your select list for each row should not have matching values between EMP_ID1 and EMP_ID2. APEX can create the dynamic query for you, you just select the columns you want to base the LOV on, then modify the query after.

  • Primary Key With Four Column ,How to use that Column As Primary Key In Form

    Dear All,
    i have create composite Key as primary Key With Four Column .
    How can i use these column in Form With Report Page.
    How can i use these four Column as primary Key to Edit Record .
    How can i do this.
    Thanks
    Vedant

    wrap a view around your table with this bogus primary key. Use an instead of trigger to handle the inserts and updates. And then look at using surrogate keys to resolve these bad design issues...
    5 out of 4 people don't understand fractions.
    Thank you,
    Tony Miller
    Webster, TX

  • Tabular forms based on pipelined functions - can it be done?

    Hi there,
    Pipelined functions are great, specially when you want to encapsulate the access to tables instead of just SELECTing from them (what I am doing a lot in my current project.)
    However Apex 4 does not like them, at least not for tabular forms...
    I want to handle myself the update/insert/delete process, so I don't need the MRU default functionality (all the access to the data is via APIs). But at the same time I want to just SELECT from my pipelined function and set the item types using the builder interface as with any tabular form (without having to use the apex_item API). Also I want to be able to use tabular form validation.
    To start with, you can only create a tabular form based on a table or view. To overcome this issue, I created a dummy view with the fields I wanted and created my tabular form on it. Then I changed the FROM clause to FROM TABLE(myfunction). It didn't work as it seems it tries to select the ROWID for each row... Of course my pipelined function doesn't return one but I don't need one anyway as I will be doing the data manipulation myself based on the PK.
    For this to work, I had to create a collection, populate it with the result of the pipelined function in a page process every time the page is loaded, create a view on that collection and base the tabular form on the view... A lot of work and overhead for something that should be very simple in principle.
    Then, I found out that if I remove the default MRU process that is automatically created, the tabular form validations stop working (as I posted in another thread). So I have to leave a "dummy" MRU process there with condition = never for it to work.
    The application I am working on is all based on API calls and pipelined functions so all this work has to be repeated for each tabular form that is needed.
    If it was possible to base a tabular form directly on a pipelined function it would be such an elegant solution.
    Is there a better way to implement this? Shouldn't Apex be more compatible with pipelined functions? (at least in regards to tabular forms, they work well with normal forms, reports, LOVs etc)
    Thanks
    Luis

    As I mentioned before, I don't handle inserts (well, I cheat).... On my page, there is a form to set up a request - prompts for a few things, and when submitted, calls a stored procedure:
    :P2_REQUEST_RESULT := Simon.Apex_Campus_Guest.Setup_Request(:P2_GROUP_NAME,
           :P2_COAS_ORGN, :P2_START_DATE, :P2_END_DATE, :P2_Quantity, :P2_Generic_Names);
    Which creates an APEX collection, which in turn is made visible via a pipelined function turned into a view:
    create or replace view Apex_Campus_Guest_Request_va as
    select seq_no,
            user_name,
           group_name,
            comments
      from table ( Apex_Campus_Guest.Request_Result )
    I have a second region which is tabular form on a query - conditional on select 1 from Simon.apex_campus_guest_request_va (the view defined above).
    When this submitted, I have standard MRU and MRD processes (Seq_No is the primary key). This then runs into the appropriate trigger - the update trigger is as follows:
    trigger Apex_Campus_Guest_Req_Upd
    instead of update on Apex_Campus_Guest_Request_va
    for each row
    declare
            cg_rec  campus_guest_maint.rec;
    begin
            cg_rec := Campus_Guest_Maint.Request(
                            name => :new.user_name,
                            group_name => :new.group_name,
                            comments => :new.comments);
    end;I don't know off hand why it isn't asking for a rowid - but may be that I specified a PKEY column. The insert case fails, as it tries to add a "Returning" statement in the original select. I actually find that annoying as a function is defined to allocate the PKEY from a sequence, so it doesn't need to ask for it that way.

  • Problem in tabular form based on dynamic view and pagination

    Hi All,
    I have a manual tabular form based on a dynamic view. The view fetches the records based on search criteria given by the user in all cases. But this view fetches ALL records when user clicks on pagination, without considering the search criteria. This is the problem I am facing.
    I am doing the following:
    Since tabular form does not support pl/sql function returning query, I cannot use a table directly. I need my results based on search criteria selected by user. Hence I created a dynamic view and used a "INSTEAD OF UPDATE" trigger to update the table.
    I use a set bind variables procedure, on load before header for setting the variables.
    This view fetches the correct data based on user search always. It creates a problem only in one situation, when using pagination in the report.
    The example can be found at:
    http://apex.oracle.com/pls/otn/f?p=19399:1:
    username = [email protected]
    pwd = kishore
    Here if "manager name" is entered as test, we get 5 records in "Summary of requests" report and 5 records in "Inactive Requests" report. When user clicks on Pagination in any of the reports, ALL the 7 records get fetched in "Summary of Requests" and 6 records in "Inactive Requests". How can I overcome this problem?? The report must consider the search variables even when pagination occurs.
    Is this because, the inbuilt "html_PPR_Report_Page" executes the region query once again by considering all search variables as NULL?
    Backend Code is at:
    http://apex.oracle.com/pls/otn/
    workspace: sekhar.nooney
    Username :[email protected]
    pwd: kishore
    application id = 19399
    My region code is something like:
    select *
    from regadm_request_v
    where access_type = :F110_REGADM
    and status <> 'INACTIVE'
    order by request_id
    My view code is:
    CREATE OR REPLACE VIEW REGADM_REQUEST_V
    AS
    SELECT *
    FROM REGREGOWNER.REGADM_REQUEST
    WHERE upper(employee_name) LIKE '%'||nvl(upper(REGADM_REQUEST_PKG.GET_EMPLOYEE_NAME),'%')||'%'
    AND upper(manager_name) LIKE '%'||nvl(upper(REGADM_REQUEST_PKG.GET_MANAGER_NAME),'%')||'%'
    AND upper(employee_sunetid) LIKE '%'||nvl(upper(REGADM_REQUEST_PKG.GET_EMPLOYEE_SUNET_ID),'%')||'%'
    AND upper(manager_sunetid) LIKE '%'||nvl(upper(REGADM_REQUEST_PKG.GET_MANAGER_SUNET_ID),'%')||'%'
    AND upper(request_date) LIKE '%'||nvl(upper(REGADM_REQUEST_PKG.GET_REQUEST_DATE),'%')||'%'
    AND upper(USAGE_AGREEMENT_RECVD) LIKE '%'||nvl(upper(DECODE(REGADM_REQUEST_PKG.GET_USAGE_AGREMNT_RECVD,'~!@',NULL,REGADM_REQUEST_PKG.GET_USAGE_AGREMNT_RECVD)),'%')||'%'
    AND upper(STATUS) LIKE '%'||nvl(upper(DECODE(REGADM_REQUEST_PKG.GET_STATUS,'~!@',NULL,REGADM_REQUEST_PKG.GET_STATUS)),'%')||'%'
    AND upper(REQUEST_APPROVED) LIKE '%'||nvl(upper(DECODE(REGADM_REQUEST_PKG.GET_REQUEST_APPROVED,'~!@',NULL,REGADM_REQUEST_PKG.GET_REQUEST_APPROVED)),'%')||'%'
    AND upper(nvl(APPROVAL_DATE,sysdate)) LIKE '%'||nvl(upper(REGADM_REQUEST_PKG.GET_APPROVED_DATE),'%')||'%'
    AND upper(APRVL_REQUEST_SENT) LIKE '%'||nvl(upper(DECODE(REGADM_REQUEST_PKG.GET_EMAIL_APPROVERS,'~!@',NULL,REGADM_REQUEST_PKG.GET_EMAIL_APPROVERS)),'%')||'%'
    AND upper(NOTIFY_APPROVED) LIKE '%'||nvl(upper(DECODE(REGADM_REQUEST_PKG.GET_APPROVAL_NOTIFICATION,'~!@',NULL,REGADM_REQUEST_PKG.GET_APPROVAL_NOTIFICATION)),'%')||'%'
    I would be glad for any suggestions.
    Andy/Varad any ideas? You both helped me a lot on my problems for the same application that I had faced before in More Problems in Tabular form - Please give me suggestions.
    Thanks,
    Sumana

    Hi Andy,
    The view and the package for setting bind variables work properly in my entire application other than the pagination. A pity that I came across this only now :(
    I have used this same method for holding variables in another application before, where I needed to print to PDF. I used this approach in the other application because my queries were not within the APEX character limit specified for the "SQL Query of Report Query shared component".
    In this application, I initially had to fetch values from 2 tables and update the 2 tables. Updateable form works only with one table right? Hence I had created a view. Later the design got changed to include search and instead of changing the application design I just changed the view then. Still later, my clients merged the 2 tables. Once again I had just changed my view.
    Now, I wanted to know if any method was available for the pagination issue (using the view itself). Hence I posted this.
    But as you suggested, I think it is better to change the page design quickly (as it would be much easier).
    If I change the region query to use the table and the APEX bind parameters in the where clause as:
    SELECT *
    FROM REGADM_REQUEST
    WHERE upper(employee_name) LIKE '%'||nvl(upper(:P1_EMPLOYEE_NAME),'%')||'%' .....
    I also changed the ApplyMRU to refer to the table.
    Here the pagination issue is resolved. But here the "last Update By" and "Last Update Date" columns do not get updated with "SYSDATE" and "v(APP_USER)" values, when update takes place. Even if I make the columns as readonly text field, I am not sure how I can ensure that SYSDATE and v('APP_uSER') can be passed to the columns. Any way I can ensure this? Please have a look at the issue here: http://apex.oracle.com/pls/otn/f?p=19399:1:
    I have currently resolved the "last update" column issue by modifying my view as:
    CREATE OR REPLACE VIEW REGADM_REQUEST_V
    AS
    SELECT *
    FROM REGADM_REQUEST
    I modified my region query to use APEX bind parameters itself as:
    SELECT *
    FROM REGADM_REQUEST_V
    WHERE upper(employee_name) LIKE '%'||nvl(upper(:P1_EMPLOYEE_NAME),'%')||'%' .....
    And I use the "INSTEAD OF UPDATE" trigger that I had initially written for update. The code is:
    CREATE OR REPLACE TRIGGER REGADM_REQUEST_UPD_TRG
    INSTEAD OF UPDATE
    ON REGADM_REQUEST_V
    REFERENCING NEW AS NEW OLD AS OLD
    FOR EACH ROW
    BEGIN
    UPDATE REGREGOWNER.REGADM_REQUEST
    SET MANAGER_EMAIL = :NEW.MANAGER_EMAIL
    , EMPLOYEE_EMAIL = :NEW.EMPLOYEE_EMAIL
    , STATUS_UPDATE_DATETIME = SYSDATE
    , USER_UPDATE_ID = (SELECT v('APP_USER') FROM DUAL)
    WHERE REQUEST_ID = :OLD.REQUEST_ID;
    END;
    Please let me know how I can resolve the "last update" column issue using the table itself. (Just for my learning)
    Thanks,
    Sumana

  • How can I hide primary key column in BC4J form

    I have populated a primary key with dbsequence and how can I hide it on the form. It is populated in the DB by a trigger.

    I have populated a primary key with dbsequence and how can I hide it on the form. It is populated in the DB by a trigger. To hide it, edit the attribute using attribute-editor that you bring up by double-clicking on the attribute in the "StructurePane" .
    Then go to control-hints panel and mark the attribute setting for Display = Hide.
    Then UI wizards will not add the attribute into generated panels.
    However once you have UI generated, this hint is no more used.

  • Update primary key

    Hi
    I am using weblogic 7.0 and ejb 2.0
    I have a requirement where i would want to update my primary key. If i understand right , In ejb you are not allowed to update one of the primary key column of composite primary key.
    Now if i have to update this what are the work arounds. Aslo say if i update that row through stored proc, will my ejb state in cache be in sync with latest data. Is ejb load called for sure beofre any method is called on bean.
    Please give me some inputs on this
    Thanks

    Your problem lies within your database (datasource)structure. You need to have two primary keys for that particular entity. The first primay key is internal meaning it is the true key for any specific record in the table. The second "primary key" is external meaning it is not truely a primary key with regards to the formal contstraints of your database. Instead, this is the key your users will see. It is the responsibilty of the application layer to ensure that the external id is unique. This way, you always have a lasting primary key (the internal key), yet your users can change their "primary key" whenever they like.
    As an example, I'm writing a J2EE application that provides our clients with a unique ID to access their records. My table definition would look something like:
    CREATE TABLE Client (
    clientId BIGINT AUTO_INCREMENT NOT NULL,
    externalClientId VARCHAR(15) UNIQUE NOT NULL,
    ... another field,
    ... another field,
    CONSTRAINT pk_foo PRIMARY KEY (clientId)
    The unique constraint isn't really necessary because the application layer should check for this, but it's a good safety precaution.
    On the application side, you would only expose the 'externalClientId' to the clients. This might force you to use BMP, but it keeps the user from ever changing the true Id and is fairly clean.
    Hope this helps.

  • Update primary key/delete and reinsert records

    Hi, I have been told to update some fields. The database is new to me, and now I see the field is the primary key (and it has child tables with that as foreign key). The person who told me isn't reachable until next week...
    ...wasn't a bad idea to update pk's? I see it's possible, deferring constraints...
    update primary key
    Re: Update Primary Key
    ...but it's better/safer the script deletes and later re-insert the records, right?
    Thanks

    Always is better be able to undo any change .
    But ¡, why would you update pk's? it's possible but you colud find few problems like:
    - many levels of foreign keys exists.
    - not validate pk
    Look at:
    Re: Novalidate primary key

  • How to add a new row in Tabular Form based on a table

    Hi
    I have tabular form based on a table.
    I want the table to have an empty row when there is no data
    in the table so that I can enter data directly.
    But right now whenever the page is launched, its showing a no data found message and I have to press the 'Add Row' button to enter data.
    Can anyone help me out on this?
    Thanks

    Hi Leo
    Your suggestion works fine in the APEX 2.1
    But in 3.0.1 it gives this error :
    Error in add row internal routine: ORA-01476: divisor is equal to zero
    Error Unable to add rows.
    I am not sure why this happens.

  • Is it possible to update multiple tables with a dynamic form?

    I have columns from two tables populating a dynamic form. I am trying to have the form update both tables on submit. I have tried both a linked transaction and a custom transaction but I am not making progress. Only the master table is being updated. Is it possible with ADDT to update two tables with a dynamic form?

    I meant
    SXMSMSTAT
    SXMSSYERR
    Thanks.

  • Creating a primary key with the parallel option and the tablespace option

    I know I can create a unique index with these options and then make the primary key with the "using index" clause. anyway to do this and skip the create unique index and just create the primary key ?

    SQL> ALTER TABLE t
      2  ADD CONSTRAINT pk_t
      3  PRIMARY KEY (testcol)
      4  USING INDEX
      5  TABLESPACE example
      6  PARALLEL (DEGREE 2);
    PARALLEL (DEGREE 2)
    ERROR at line 6:
    ORA-03001: unimplemented featureYou can name the tablespace but you must do an alter index thereafter.

  • How to generate the primary key item automatically in form region?.

    Hi,
    The primary key item is generated automatically in report region.I already give the pl/sql function for generating of primary key.but I want to generate the primary key value automatically in form region only?.how to do this?.Pls help me..
    Thanks and Regards.

    One of the guidelines when selecting column for a primary key is:
    Choose a column whose data values are never changed. A primary key value is only used to identify a row in the table, and its data should never be used for any other purpose. Therefore, primary key values should rarely or never be changed.
    Cheers!

  • Update primary key in replication environment.

    Hello all,
    I would appreciate, if you could answer for my question.
    I am using oracle9i advanced asynchronous replication. What would be the issue if we update the primary key. Is it going to create any problem ?. What is the drawback on updating Primary key.
    Thanks
    Govind

    Are you using DDL propagartion?
    You should not have any problems if you have unconditional supplement logging for all columns.
    But, probably it is good idea to do it in this way:
    1 stop capture
    2 change session tag
    3. change table defenition on both sides
    4. enable capture.
    5. perform capture checkpoint right after step 4.
    Regards,
    Sergey

Maybe you are looking for

  • Error While creating a regular item without any demo data.

    Hi All, In RMS13.1.1, during creation of an item without any demo data, and entering all the required inputs on the item master & itemsupp form. When we click on "Retail by Zone" the following error message got displayed "Exchange rates does not exis

  • Is there risk in partitioning an external HD that has existing files on it?

    I have a 1TB external hard drive which has a lot of movies, songs and photos, etc. which I don't have backups for. The hard drive has 500GB left, and I want to make a partition of 400GB for Time Machine. I have heard that if you make a partition on a

  • BC - Word-Processing in the SAPscript Editor

    Hi, Could anyone tell me how the Link functionality in the SAPscript Editor is working? Regards, Morten

  • Can't sync google calendar to ical

    I had google calendar working perfectly using CalDav before updating to Mavericks. Even after the update it worked perfectly. Then I deleted my google account on Mavericks so I could get the email working again. Now Mac Mail works perfectly with GMai

  • Publisher to PDF - no page color

    When I try to create a PDF in Acrobat 8 Pro from my Publisher 2010 file, the page color disappears.  This didn't used to happen - any ideas?  Thanks.