Show TOC

Defining an UPDATE_INSERT StatementLocate this document in the navigation structure

Use

You use an UPDATE_INSERT statement to change and add table values.

Format of UPDATE_INSERT Statement

<StatementName>

<dbTableName action="UPDATE_INSERT">

<table>realDbTableName</table>

<access>

<col1>val1</col1>

<col2>val2new</col2>

</access>

<key1>

<col2>val2old</col2>

<col4>val4</col4>

</key1>

<key2>

<col2>val2old2</col2>

</key2>

</dbTableName>

</StatementName>

Procedure
  1. Enter the new column values in the <access> element.

    Enter exactly one <access>element.

  2. In the <key> element, enter the condition that can find the data records whose column values are to be changed.
    • You can use any number of <key> elements to formulate your condition.
    • Column values within a <key> element are combined with a logical AND; different <key> elements are combined with a logical OR.
    • If you do not define the <key>element, or if you define an empty <key> element, this means that no condition is specified and that the entire table is to be changed. If you want to ensure this does not happen, select Key Tags Mandatory in the adapter configuration.

      If you have not formulated a condition in the <key> elements, but have selected Key Tags Mandatory, this results in an error in message processing with a corresponding error output.

    If no change can be made to the database table in this action (the formulated condition does not apply to any table entry), the values described in the <access> element are added to the table in accordance with the description for the INSERT statement. <key> elements are ignored in this case.

    See: Defining an INSERT Statement

Result

The response document has the following format, where one of the two values is 0 because either an UPDATE or an INSERT action is always executed:

<update_count>count</update_count>

<insert_count>count</insert_count>