# IBM Db2 - Upsert actions

Workato offers both batch and single upsert row actions. This allows you the flexibility to choose the action that you require for your recipe and to fulfill your business needs. Check out our best practices on whether to use batch or single upsert actions and when to use insert, update, or update.

# Upsert batch of rows

This action allows you to perform an upsert (i.e. insert or update) of multiple rows in a single step. It will check if input data exists in the table. If it is present, and update is performed. Otherwise, the data is inserted as a new row.

# Input

Field Type Description
Table required Select the target table/view to work with. You can also toggle the input to text mode to enter the table/view name in text.
Rows > Rows source list required The datapill to input is the source of the batch of rows to insert to the table. This can come from any trigger or action that outputs a list datapill.
Rows > Rows fields optional Dynamically generated list of input fields, based on the columns in the target table. Map data to be inserted from the Rows source list datapill.
Unique key required Select a unique key column to deduplicate rows. Performance can be improved if the selected unique key is indexed.

# Output

Field Description
Rows affected Number of rows that were upserted

# Upsert row

This action upserts a single row into the selected table.

# Input

Field Type Description
Table required Select the target table/view to work with. You can also toggle the input to text mode to enter the table/view name in text.
Columns required Columns in the selected table are then presented as input fields here. Map the required fields from the output datatree here to upsert a row with data from preceding trigger or actions.
Primary key required Primary key value will be used to determine if an update or an insert is executed. Select a unique key column to deduplicate rows. Performance can be improved if the selected unique key is indexed.

# Output

Field Description
Rows affected Number of rows that were upserted


Last updated: 9/27/2022, 6:49:03 AM