Information

This site will undergo a brief period of maintenance on Friday, 18 December at 12:30 AM Central/12:00 PM IST. During a 30 minute window, site availability may be intermittent.

Default language.

SQL Update – Source Reference


The SQL Update <SQLUpdate> element is used for updating data in Db2. It can contain a number of SQL statements for inserting, updating and deleting rows. It can even be used to create and drop tables.
Syntax
The syntax of the SQL Update element is

<SQLUpdate name="<a label>">
<Statement><![CDATA[All the statements separated by ;]]>
</Statement>
</SQLUpdate>

The name attribute is only used to present in the user interface and in the execution log file. All SQL statements are written in the Statement element that is using a CDATA to preserve statements for an greater visual experience when looking at the source.

Example
The following example shows how to a row is deleted, then a new row is inserted and finally the same row is updated. The example uses variable substitution and the variable rident must be present earlier in the test scenario. This variable contains the ID of the employee to delete, insert and update.

<SQLUpdate name="Update employees">
<Statement><![CDATA[delete from XATEST.XAEMPLOYEE where
RIDENT=${rident};
insert into XATEST.XAEMPLOYEE (RIDENT,FIRSTNAME,LASTNAME)
 values (${rident},'Steen','Brahe');
 update XATEST.XAEMPLOYEE set FIRSTNAME='Steen1' where RIDENT=${rident};]]>
</Statement>
</SQLUpdate>

 

Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*

BMC AMI DevX Workbench for Eclipse 23.07