1 Reply Latest reply on Oct 25, 2013 1:40 PM by CraigB

    Database Item not getting saved in DB


      Hi Experts,


      Forms version (Production)

      Database version :


      Oracle Database 11g Enterprise Edition Release - Production

      PL/SQL Release - Production

      "CORE Production"

      TNS for Linux: Version - Production

      NLSRTL Version - Production



      I have an Database Block say 'Commercials' ,in which there are 15 database items. I enter value in these items and save the values in DB. But the requirement is, upon updation of the values enterd in any one of the 15 items, it should not get updated in DB, instead a new set of values with a new primary key should be inserted into the DB as a new row. To do so, an package is called in the Key commit trigger  and in ON-UPDATE trigger, i give null there, inorder to avoid updation of  values in the same record.


      The above scenario works perfectly. Now, I add an new column in DB (as 16th column in Block).   I need only this specific column to get updated.


      When i put fnd_message on execution, it fires in the key-commit and says 1 record is applied and saved. But it is not saving in DB. especially that 16th column is not getting updated in DB.

      While updating the record, The flow of trigger moves to On- Update through Key-commit..


      What can be given in the On-update trigger to make the 16th column to get saved in DB.


      Thanks and Regards,


        • 1. Re: Database Item not getting saved in DB


          Can you please show us what code you have written in your On-Update trigger?


          Just thinking through the process, I would expect to see some checks to see which columns have been updated so you can determine whether to create a new record (column 1-15) or update an existing record (column 16).  To do this type of thing, you will need to compare the Current Value of the column to the value that was fetched from the database.  Unfortunately, Forms does not have a System Variable that records the status of each item like it does the Record, Block or Form status so you have to perform this comparison yourself.  Thankfully, Oracle Forms does have a built-in that will help with this; GET_ITEM_PROPERTY('ITEM_NAME', DATABASE_VALUE).  The DATABASE_VALUE property returns the value that was originally fetched from the database.  Your comparison would look something like:


            --Column value has changed...If Column 1-15, insert a new record
            --If Column 16, Udpated existing record...
           END IF;


          This is a very simplistic example, but hopefully it will demonstrate what you need to do.  After that, it is simply writting the DML to INSERT or UPDATE the appropriate record.