Version 4.2.5
 —  Database Management System Interfaces  —

NDB - UPDATE - SQL

Both the cursor-oriented or Positioned UPDATE, and the non-cursor or Searched UPDATE SQL statements are supported as part of Natural SQL. Both of them reference either a table or a Natural view.

With DB2, the name of a table or Natural view to be referenced by a Searched UPDATE can be assigned a correlation-name. This does not correspond to the standard SQL syntax definition and therefore belongs to the Natural Extended Set.

The Searched UPDATE statement must be used, for example, to update a primary key field, since DB2 does not allow updating of columns of a primary key by using a Positioned UPDATE statement.

Note:
If you use the SET * notation, all fields of the referenced Natural view are added to the FOR UPDATE OF and SET lists. Therefore, ensure that your view contains only fields which can be updated; otherwise, a negative SQLCODE is returned by DB2.

Futher details and syntax: UPDATE in Natural SQL Statements in the Natural Statements documentation.

Top of page