Tabular Form update,delete

Hi,
I am using database 11G, on windows XP with apex 3.0. I have created a tabular form with update & delete buttons. The table is a detail table having foreign key columns. On creation of form I choose foreign key column as primary key. The problem is when i check one row for delete the rows having same id on foreign key column are also deleted. Second When I update the following error is reported & no column is updated,
Error in mru internal routine: ORA-20001: Error in MRU: row= 1, ORA-20001: ORA-20001: Current version of data in database has changed since user initiated update process. current checksum = "197D508D2444826DA98FC1E3D259EA31", item checksum = "F98E67DE7FF4EC9710E5A1B052E38C78"., update "HT"."INTRA_ORAL_EXAM" set "OPD#" = :b1, "TOOTH#" = :b2, "RESTORATION" = :b3, "DENETAL_DECAY" = :b4, "XRAY" = :b5, "SYMTOM" = :b6
     Error      Unable to process update.
need help
Sajjad

Hi,
OK - that makes it a bit more complicated as you can not add a primary key to a table that contains data. This means that we will have to copy the data into a temporary table first.
Assume that you have a table called C_TABLE that is defined as:
CREATE TABLE C_TABLE
FIELD1 NUMBER,
FIELD2 NUMBER
)These are the steps that you need to do (each of these bits of code run be run separately):
Firstly, copy the data into a new table:
CREATE TABLE C_TABLE_COPY
AS
SELECT FIELD1, FIELD2
FROM C_TABLECheck that the table has been created:
SELECT * FROM C_TABLE_COPYThen drop the existing table:
DROP TABLE C_TABLECreate C_TABLE with a new Primary Key column:
CREATE TABLE C_TABLE
C_ID NUMBER,
FIELD1 NUMBER,
FIELD2 NUMBER,
CONSTRAINT "C_TABLE_PK" PRIMARY KEY (C_ID)
)Create a new SEQUENCE object to provide the primary key with values:
CREATE SEQUENCE "C_ID_SEQ" MINVALUE 1 MAXVALUE 99999999999999999999999 INCREMENT BY 1 START WITH 1 NOCACHE NOORDER NOCYCLECreate a new TRIGGER object to populate the primary keys with new SEQUENCE numbers when new records are added to C_TABLE:
CREATE OR REPLACE TRIGGER "C_TABLE_BI"
BEFORE
INSERT ON C_TABLE
FOR EACH ROW
DECLARE
  v_id NUMBER;
BEGIN
  BEGIN
    IF :NEW.C_ID IS NULL THEN
      SELECT C_ID_SEQ.nextval INTO v_id FROM dual;
      :NEW.C_ID := v_id;
    END IF;
  END;
END;Enable the trigger:
ALTER TRIGGER "C_TABLE_BI" ENABLECopy the data back into the table:
INSERT INTO C_TABLE (FIELD1, FIELD2)
SELECT FIELD1, FIELD2
FROM C_TABLE_COPYCheck the new table has primary keys:
SELECT * FROM C_TABLEAndy

Similar Messages

  • Forms need to get next record value in  tabular forms, update # on delete

    the isusue
    In a tabular form (multirecord)...when i enter + to add the first record , it should add 1 in this item 'order' and if i hit + again then it should enter 2 and so on....
    where users would enter different records at once and save it .However if they were to delete a record in the middle ...
    say record
    1
    2
    3
    4
    5
    6
    and delete 2 and 3 then # 4 should be 2 and # 5 should be 3 and #6 would be 4 . if they are to add a new record then it should assign the next number which would be 5
    what i have done is created a non database item in that block and made it a summary field with max
    and in the when_new__record_instance trigger...i am doing somthing like
    If block.item is NULL
    THEN
    block.item = block.non_database_item +1
    end if
    got this from a post here by Francois...
    it is adding just 1 everytime i hit + to add a new record...when the item is null in the beginning. However if i save the first record then click + to add new record then it goes inseries like 2..3..4....
    Any help would be appreicated . Thanks

    HI,
    Check following thread you may useful
    Maximum create call for the VO

  • How to create a manual tabular form with DELETE capability

    Since the wizard tabular form does not allow the use of checkboxes, I am building my tabular form manually following the HOW-TO document. I will need to be able to delete rows in the form in addition to inserting and updating. Is there a document somewhere that describes how to do this? The how-to doesn't cover it and I have searched the forums to no avail.
    Thanks.
    Darin

    To create dynamic checkbox you can do the following:
    SELECT HTMLDB_ITEM.CHECKBOX(1,"your database field name", 'unchecked or checked') " "
    FROM YOUR_TABLE_NAME OR DUAL;
    ...then...
    In order to extrapolate the checkbox value you use following array:
    htmldb_application.g_f01("subscript value)"
    This array will contain value of checkbox. At this point you can do this:
    if htmldb_application.g_f01("subscript value)" = 'Y'
    THEN
    INSERT DATA...
    DELETE DATA...
    END IF;
    Hope this somewhat helps...
    NOTE: I have entered a lot of pseudo values/code but I believe you can fill in the blanks for what you need.

  • Tabular form update

    Hi everyone,
    I am working on apex 4.1, oracle 11g database.
    I have a tabular form with a first column of checkboxes.
    I want to check all the rows taht interest me, and update them with a value from a select list.
    It is exactly as if i wanted to delete the checked rows, only that i want to update them all with a value.
    Can anyone help me with this?
    I can't seem to find a way to select the rows that are checked.
    Thank you,
    Alex.

    See this http://docs.oracle.com/cd/E23903_01/doc/doc.41/e21676/apex_app.htm#CHDICJDA

  • TABULAR FORM UPDATE ERROR CURRENT VERSION OF DATA IN DB HAS CHANGED...!

    Hi all Experts on Apex 423 and Oracle xe 11g r2...
    I'm getting a systematic error when updating a Apex Tabular form : the Oracle internal engine complaining that the row ID's are out of syncr?  I'm use ROWID instead of ID  ( trigger has been created but I think should not used ...!)
    Any advise.
    remark:  The  SIMPLE DATA APPLICATION has the same issue when trying to update the QUANTITY field on ORDERS... STRANGE NOT?
    MFOConsulting  Switzerland
    [email protected]

    Hi All Apex Experts,
    Détails  with Détails records  in a TABULAR FORM .
    I tranformed this program Master-Détails with Détails records  in FORM ( not tabular)  and this  error message is no more displayed on the screen.!!
    CONCLUSION:   there is a   SERIUOS  BUG in Apex 423.00.08   and 424.00.008!!
    I hope that People in Oracle Corporation is  working on this bug. and the next release of  Apex 5.0 will correct it.
    PS:   The SIMPLE DATA BASE installed   with any version of Apex... display this MSg .( update ORDERS  quantity of items and you recieve thiS fanny message!
    MFOConsulting Switzerland

  • Tabular form Update Error,"Current version of data in database has changed

    I'm getting an error when updating a Apex Tabular form. It's complaining that the row id's are out-of-sync. The error reads,' Current version of data in database has changed since user initiated update process. current row version identifier = "56DW5A8A7EBA3B42073AE6E71480A784" application row version identifier = "99B52A15F10E34647E9E18B6B7AE8C30" .
    Has anyone received this error? Any solutions? Note that the primary is being populated by a trigger. I have another tabular form for a different application that updates without issue, this however, uses a sequence to update the primary key.
    Thanks,
    James

    Make sure that the form is defined such that it "knows" that the PK is being set by a trigger. Do not try to set it in the form if the trigger is doing it. Pretty much if a trigger attempt to modify any column that also was editable (including hidden columns) in the form, the two will conflict.
    The other issue could be that do you have any items on the rows that are disabled? Disabled items are not sent to session state so Apex won't be able to properly compute the checksum and it'll find a discrepancy.

  • Manual tabular form "Update Process"

    Hello,
    i made a tabular form manually,
    now i want to add an update process, but its not working?
    I created a Button "P_UPDATE" and i added a Process which listens to the P_UPDATE Button.
    i used the following PL/SQL script:
    for i in 1..htmldb_application.g_f01.count
    loop
    update MATCHUMSATZ
    set PARTNER_ID = replace(htmldb_application.g_f10(i),'%'||'null%',NULL),
    RECH_DATUM = replace(htmldb_application.g_f02(i),'%'||'null%',null),
    RECH_NR= htmldb_application.g_f06(i),
    PROV_GRUNDLAGE= htmldb_application.g_f08(i),
    KUNDE= htmldb_application.g_f14(i),
    VERTRIEBSART_ID = replace(htmldb_application.g_f17(i),'%'||'null%',NULL)
    where id = htmldb_application.g_f01(i);
    end loop;
    This is an example which i customized from: http://www.oracle.com/technology/products/database/application_express/howtos/tabular_form.html
    I suppose that 'htmldb_application.g_f01' is the ID of the table 'MATCHUMSATZ'.
    Why is there replace() and sometimes not ?
    Would be glad if anybody could help me!
    Phil

    Hi Phil,
    You can add in the in-built MRU update process that will do this for you. When you add a process, select Data Manipulation then Multi Row Update, then follow the prompts to link it to your table.
    In your code snippet, htmldb_application.g_f01 refers to the first column in your form (even if this is hidden). Normally this is the Primary Key for the table on which the form is based. htmldb_application.g_f02 refers to the second column and so on, although you can assign any number from 1 to 50 to each field when you create the sql statement.
    The replace() function is used because some of the fields will contain %null% which needs to be converted to null before updating the table.
    Regards
    Andy

  • Apex_Item.radiogroup in a Tabular Form (Update Only, no Insert)

    Hi,
    I'd like to use a radiogroup on a tabular Form. The Form will modify only existing records.
    I've seen some more elaborate examples for Tab Forms that allow Insert.
    But I am trying to use the APEX_Item.radiogroup function for an example like:
    "Select Chairperson_Name, Approve_Status FROM Chairperson_Approval"
    The Approve_Status column can be 'A' for Accept, or 'R' for Reject, and is the only updateable column in the Tabular Form.
    So I should be able to create a Tabular Form (for Update Only) on the table Chairperson_Approval with the wizard.
    Then I want to be able to go into the Source and change the SELECT statement to something like:
    "Select Chairperson_Name, APEX_Item.radiogroup(1,approve_status,.....) FROM Chairperson_Approval"
    and then let the automatic APEX processing (generated by the wizard) do the rest. Right? Can
    anybody give me an exact example for APEX_Item.radiogroup. My documentation is not clear enough on this function.
    Thank you very much, in advance.
    Carol

    Hi Andy,
    Why do you get & set TEST attribute of the radiobutton?
    What is a TEST attribute?
    getAttribute("TEST") == 'Y')
    setAttribute("TEST","Y");So I was thinking I should incorporate this toggle me function with my radiobutton and have the following inside the toggleMe function.
    $x(''P24_SECONDARY_TASK'').value=' || ad.task_id || '"')
    {code}
    Am I right?
    Cheers
    -Joel                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • APEX tabular form update recognition

    Dear all,
    I am quite new to APEX so please apologize if I am asking "stupid" questions. Unfortunately, the information I was able to find up to now was only partially helpful. Apparently I must be missing something obvious. The APEX version I use is 4.0.1.
    When submitting a page that contains a tabular form, I need to find out, which record has been created or updated in order to fill in additional information automatically, e.g. logging data (created, last updated, ...). I cannot do this in a trigger, because the trigger sees only APEX_PUBLIC_USER and does not know about the "real" user who has connected to the database. If there is a better or easier way to do this, please let me know.
    My problem is to find out, if a new record has been added by clicking the "add row" button and / or if an existing record has been modified, because creation and modification have to be handled differently. Existing and unmodified records in the table must not be touched. I can access the columns by using APEX_APPLICATION.G_Fxx() but how do I recognize modifications? In a thread in this forum I found information about using a MD5 checksum. So I have added a checksum field using APEX_ITEM.MD5_HIDDEN() and tried to check this information. Unfortunately, doing this, I already get a problem when I submit the page after having added an empty record by clicking on "add row" but without having supplied any information. APEX then complains about information that has been modified in the meantime instead of just ignoring the empty record. This is probably because APEX considers the record as changed because of the checksum column I have added (I have read that the SQL query to create the tabular form must not be altered).
    Could anybody please show me the right way to do such a check?
    Thank you very much for your help.
    Best regards,
    Ralf Gorholt

    Hi Ralph,
    Well, if you are wanting to check if anything has been updated before the update button is pressed, using JS, you can use the property of the field 'defaultValue' and compare it to the property 'value'
    i.e. for the text input type
    function isElementChanged( myElement ) {
      var iselementChanged = false;
      var returnVal = false;
      switch ( myElement.type ) {
      case "text" :
        if ( myElement.value != myElement.defaultValue )
          return true;
        break;
    default
         return false;
    }  You could cycle through all elements, by:
    allEls = form.elements;
    for (i=0; i < allEls.length; i++){
      if ( allEls.type != undefined && allEls[i].type.length > 0 && allEls[i].disabled == false ) {
    if (isElementChanged(allElls[i])) {
    //TODO: logic here
    }Ta,<br />Trent                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • APEX - tabular form update

    Hey guys,
    as per client's request, we need to insert rows into db from tabular form even there is no change on the new row. db table is configured to have nullable fields.
    Currently, it won't allow me to do so. Is there any way to force the insert/update without checking if the information on the row is updated?
    Thanks a lot

    You can do it, using manular tabular form.
    When you use automated Tabular Forms, it checks inbuilt global variables, to see row is updated or any new row is created and all necessary fields are keyed in.
    If you don't update an existing row, that row will not be updated..
    If you create/add new empty row and don't key in values, that row will not be inserted as there is no data..
    If you want to do in that manner, make your MRU process on the page to never and write your own manual MRU

  • Tabular form update manual

    Dears ,
    i have manual tabular form
    select htmldb_item.checkbox(1,rownum) " ",
           x.service_id,
           x.service_name,
    htmldb_item.checkbox( 4, flag,decode( flag, 1, 1, 0) ) flag
    from (
    select htmldb_item.hidden(2,c.service_id) service_id,
              htmldb_item.text(3,s.service_name)  service_name,
               htmldb_item.checkbox( 4, flag,decode( flag, 1, 1, 0) ) flag
    from  CUST_SERVICES c,SERVICES s
    where c.service_id=s.service_id
    and  c.cust_id=:p6_customer_id) x
    order by 2and make process to save
    Type:     PL/SQL anonymous block
    Process Point : on submit - after computation and validation
    Run Process : once per page visit (defult)
    source code :
    for i in 1..htmldb_application.g_f01.count
    loop
    update CUST_SERVICES set flag = htmldb_application.g_f04(htmldb_application.g_f01(i));
    -- where CUST_ID=:p6_customer_id
    -- and  SERVICE_ID =htmldb_application.g_f02(htmldb_application.g_f01(i));
    end loop;put it's not save , please help

    Hi Phil,
    You can add in the in-built MRU update process that will do this for you. When you add a process, select Data Manipulation then Multi Row Update, then follow the prompts to link it to your table.
    In your code snippet, htmldb_application.g_f01 refers to the first column in your form (even if this is hidden). Normally this is the Primary Key for the table on which the form is based. htmldb_application.g_f02 refers to the second column and so on, although you can assign any number from 1 to 50 to each field when you create the sql statement.
    The replace() function is used because some of the fields will contain %null% which needs to be converted to null before updating the table.
    Regards
    Andy

  • Tabular Form : Update column

    Table  - TIME_RECORD
    Manual Tabular Form query
    SELECT APEX_ITEM.TEXT(31,E_TIME,30,35,'f31_'|| '#ROWNUM#')ETIME
    FROM   TIME_RECORD
    E_TIME column value is 11/29/2012 2:42:43 PM
    When running the form the column displays  - 29-NOV-12, the time part is not displayed.
    Please suggest why only date is displayed ? why Time is not displayed.
    Sanjay

    user12957777 ,
    Implicit conversion of DATE to VARCHAR2 uses the NLS DATE FORMAT.
    Try
    SELECT APEX_ITEM.TEXT(31,TO_CHAR(E_TIME,'DD-MON-RR HH24:MI:SS'),30,35,'f31_'|| '#ROWNUM#')ETIME
    FROM   TIME_RECORDUse the format mask that you need.

  • Once more - tabular form / update only rows that have changed

    I know it's been asked before, but I haven't seen an answer I like. :-)
    I have a query that includes a single column the user can update, using APEX_ITEM.TEXT(10, updateable_field, 10, 10)
    I have an additional APEX_ITEM.HIDDEN(21) and APEX_ITEM.HIDDEN(22) that hold the two fields of the composite primary key. In order to track whether my updateable_field had changed, I created APEX_ITEM.HIDDEN(11, updateable_field), which I expected would hold the OLD value of the field. See where I'm going with this? :-)
    I'm attempting to loop through apex_application.g_f21, get the values for F10 (new) and F11 (old) and compare them. If they're different, I'll do the update.
    It works fine if the old value (F11) is empty and I plug in a new value (to F10).
    But if I change a field that had already has a value (in F11) and make it NULL, I notice that F11(i) doesn't exist. In that case, I set the value to NULL, and the compare fails because it thinks the row is unchanged.
    Can someone suggest or point me to an alternate method that works?
    Thanks as always,
    Stew

    Mike,
    Thanks for the suggestion, which is a good one. But I had that one covered.
    I have it working now, and I believe the fix was that I moved the APEX_ITEM.HIDDEN that contained the old value in the query. I'd had it concatenated with the column for the new value (which used APEX_ITEM.ITEM). I changed it to concatenate to a plain string value. And now the array has values in it, which I can properly compare.
    Thanks again. That was really driving me nuts!
    Stew

  • Tabular form - how to insert the latest timestamp based on the action

    I am using tabular form(updatable sql report) to insert/update multiple values into one table. I have two data elements that is hidden from the user, Created_dt and Update_Dt.
    I need to insert Created_Dt with current system date value when new record is created and update Update_Dt when current record is updated. I need to implement similar logic for Created_By and Updated_By so I cannot use database trigger.
    I am not able to figure how to do this. Can someone please help me with it?
    Thanks!

    Sample trigger showing how to store date/time and user id of who changes a row:
    CREATE OR REPLACE TRIGGER  "gartner_USER_REPOSITORY_T1" BEFORE INSERT OR UPDATE ON  "GARTNER_USER_REPOSITORY" REFERENCING OLD AS "OLD" NEW AS "NEW" FOR EACH ROW begin
       begin
          if inserting then
             if :NEW.USER_ID is null then
               select gartner_User_Repository_SEQ.NEXTVAL into :NEW.USER_ID
               from dual;
             end if;
             IF :NEW.CREATED_BY IS NULL THEN
               :NEW.CREATED_ON := SYSDATE;
               :NEW.CREATED_BY := nvl(v('APP_USER'),USER);
             END IF;
          end if;
          if updating then
             :NEW.Modified_ON := SYSDATE;
             :NEW.Modified_BY := nvl(v('APP_USER'),USER);
          end if;
       end;
    end;
    ALTER TRIGGER  "gartner_USER_REPOSITORY_T1" ENABLE
    /Thank you,
    Tony Miller
    Webster, TX
    You can get more with a kind word and a two-by-four than you can with just a kind word
    If this question is answered, please mark the thread as closed and assign points where earned..

  • Two Manual Tabular forms in a same page

    Since i have to create two tabular forms in a same page, i created tabular forms manually.
    Both the forms are working fine if the columns are not defined as conditional display.
    Based on item value set by user, few fields should be either displayed as text field (editable) or read only (display).
    I created two columns for a same field one as editable another one as non editable.
    Based on item value any one of the column will be displayed.
    Since the manual tabular form update process is using 'apex_application.g_f02', if any one of the column is not visible,
    multiple row update is failing.
    can any one please help me or suggest me to solve this.
    Edited by: Ravi on Apr 19, 2012 9:02 AM

    I'm guessing you have a page item that is used to control display of the columns as display only or editable.
    If that's true and the page item tells you to display the editable column, then you end up with say a g_f02 and a g_fo3, where you otherwise might only have a g_fo2.
    Use the value of the page item in your update process to control which tabular form element to use.

Maybe you are looking for

  • How do I find the root cause of a NetConnection closed event?

    Hi, I am maintaining a large project developed in Flex/Actionscript. The application is using tunneling (RTMPT), and we often get Netconnection "closed" events. There is no problem with the physical network. I think the event may be caused by either

  • How to activate a different sub-report for each row in the data set as main report page breaks on each row of data in the main dataset

    I am going to try asking this same question a different way as I have yet to find a working solution to my problem.  I have a main report and then 8 sub reports.  My main report has one data set and returns one row of data per account number.  One of

  • Video Languages grayed out

    Hi, First I must say I'm sorry if this has already been answered but I haven't been able to find anything that quite fits. I have copied some DVDs I own using Mactheripper and handbrake and have added two audio tracks to use in iTunes and on my iPad

  • Ipad 2 & Apple TV

    I completd the WiFi for both ipad 2 & Apple TV in my corporate network (Same WiFi setting). But i can't found the AirPlay icon in ipad2.(It may be block by some Windows server policy) When i reconfigured both device in difference WiFi enviroment (low

  • Application Descriptor cannot be parsed?

    Been working on an iPad app in CS5.5 for a couple weeks and started getting this error today when trying to test. Tried to delete the file, and the new one gives the same result. Pasted the xml into a validator and it validates fine... 5.5 is really