1. Get rid of all advertisements and get unlimited access to documents by upgrading to Premium Membership. Upgrade to Premium Now and also get a Premium Badge!

API's ( What is the Object Version Number and how do I assign values)

Discussion in 'Oracle Apps Technical' started by shrikantgarud, Oct 12, 2009.

  1. shrikantgarud

    shrikantgarud Forum Advisor

    Messages:
    21
    Likes Received:
    5
    Trophy Points:
    110
    Location:
    Mumbai
    Object Version Number (OVN) is a column in a database table. It is used to track multiple changes to a record. When a new row is inserted, the OVN is set to 1. As updates are performed on the row through the Forms, the OVN is incremented. The OVN is transferred with a queried row. If an update is attempted when the change is saved to the table, the current OVN is compared with the value being passed back from the transaction. If the two are the same, the update can be committed to the table. If the two are different, the update is rejected and flagged with an error. The transaction must be re-queried, and the update made again to the more current version of the row.

    APIs and Forms use OVNs similarly. Every published API has the p_object version_number control parameter.

    For Create APIs, this parameter is defined as an OUT parameter: the API assigns the object version number to 1 for row inserts. For Update APIs, the parameter is defined as IN OUT, and is mandatory in the API call.

    The current value must be passed in the API call and it is compared to the version on the row in the table. If the versions are different, the error HR_7155_OBJECT_LOCKED is raised. The information can be re-queried for a more current version.

    You can use the following query to determine the OVN to pass in your API call:

    Code (SQL):

    SELECT MAX(Object_version_number)
    FROM <per_all_assignments_f>
    WHERE <person_id> = <l_person_id>;