The UPDATE statement updates values in selected columns in a table. You can use this statement with a cursor.
LSQL UPDATE tablename SET colname=value... [WHERE criteria]
Parameters
Name of the column containing values to be updated.
Criteria on a WHERE clause can be any valid search criteria. When using a cursor, the criteria on a WHERE clause must include CURRENT OF cursorname. This criteria causes the function to be performed on the current row being processed in the cursorname operation. (See the example that follows.)
Name of the table you are updating.
Value that you are inserting into this column. The value can be a character string, numeric string, or host variable.
Note: You can use host variables for colname or tablename.
Examples
Suppose you want to search the APPLICATIONS table for all applications with a status of DOWN and change that status to UP. Issue the following LSQL command:
LSQL UPDATE APPLICATIONS SET STATUS ='UP' WHERE STATUS ='DOWN'
To set the value of the STATUS column to UP for the current row when using a cursor named STATDOWN, issue the following LSQL command:
LSQL UPDATE APPLICATIONS SET STATUS='UP' WHERE CURRENT OF STATDOWN
Copyright © 2014 CA Technologies.
All rights reserved.
|
|