SQL_UPDATE

LANSA Composer

SQL_UPDATE

This activity executes a specified SQL statement to update a database.  Typically, this will be an INSERT, DELETE or UPDATE statement.

This activity supports the use of SQL parameter markers (usually designated by a question mark) in the SQL statement.  If your solution uses this capability, you must first execute one of the following activities to supply the parameter value(s):

SQL_PARAMS

Set parameter values for SQL operation

SQL_PARAMSCSV

Set parameter values for SQL operation from CSV

 

 

For more information about the SQL database activities, refer to the description of the SQL_CONNECT activity.  For a list of supplied working (*) examples using the SQL database activities, refer to:

Example Processing Sequences using the SQL database activities

INPUT Parameters:

SQLHANDLE : Required

This parameter must specify the connection handle value that identifies the SQL connection upon which this activity should operate.  The connection handle value is returned by the SQL_CONNECT activity.

SQLUPDATE : Required

This parameter must specify the SQL statement that will execute to update the target database.  Typically, this will be an INSERT, DELETE or UPDATE statement.

The SQL statement may make use of parameter markers (usually designated by a question mark).  You must use either the SQL_PARAMS or the SQL_PARAMSCSV activity before this activity, to supply the parameter values.

Where the SQL_PARAMS or the SQL_PARAMSCSV activity have been used to supply parameter values, the SQL statement will be prepared before executing it repeatedly for each supplied set (or "row") of parameter values.  The following is an example of such an SQL update statement that contains parameter markers:

update tutordh set orddat = ? where bchnum = ?

Where parameter values are not supplied, the statement is not prepared before it is executed and it will execute only once. The following is an example of such an SQL update statement that does NOT contain parameter markers:

update tutordh set orddat = '2014-01-01' where bchnum = '1234567890'

Since processing sequence variables are restricted to 256 characters, a single value may not be sufficiently large to hold your SQL statement.  For this reason, this parameter is defined as a variable list.  This means that you can split your long SQL statement into more than one part and provide the parts in this parameter using a variable list.  If you do this, then the SQL_UPDATE activity will re-assemble them into a single statement before preparing and executing it.

OUTPUT Parameters:

SQLROWS :

If parameter values are not supplied for use with the SQL statement, then this parameter will contain the count of the number of database rows affected by the SQL statement.

If parameter values are supplied (and the statement is consequently prepared before being executed), then the activity cannot return the affected rows count and this parameter is not used.