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]
The name of the column containing values to be updated.
The criteria on a WHERE clause can be any valid search criteria. However, when using a cursor, the criteria on a WHERE clause must include CURRENT OF cursorname, which causes the function to be performed on the current row being processed in the cursorname operation. (See the example that follows.)
The name of the table you are updating.
The 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 called STATDOWN, issue the following LSQL command:
LSQL UPDATE APPLICATIONS SET STATUS='UP' WHERE CURRENT OF STATDOWN
| Copyright © 2012 CA. All rights reserved. | Tell Technical Publications how we can improve this information |