Contents IndexUPDATE statement VALIDATE TABLE statement

User's Guide
   Part VI. SQL Anywhere Reference
     Chapter 43. Watcom-SQL Statements
      UPDATE (positioned) statement

Function

To modify the data at the current location of a cursor.

Syntax

     Syntax 1:

     UPDATE WHERE CURRENT OF cursor-name
          ... { USING DESCRIPTOR sqlda-name| FROM host-variable-list}

     Syntax 2:

     UPDATE table-list
          ... SET column-name = expression, ...
          ... WHERE CURRENT OF cursor-name

Parameters

     host-variable-list:    indicator variables allowed

     sqlda-name:    identifier

Usage

Embedded SQL, procedures, triggers, and batches..

The USING DESCRIPTOR, FROM host-variable-list, and host-variable formats are for Embedded SQL only.

Permissions

Must have UPDATE permission on the columns being modified.

Side effects

None.

See also

Description

This form of the UPDATE statement updates the current row of the specified cursor. The current row is defined to be the last row FETCHed from the cursor and the last operation on the cursor must not have been a DELETE (positioned).

For format 1, columns from the SQLDA or values from the host variable list correspond one-to-one with the select list items of the specified cursor. If the sqldata pointer in the SQLDA is the null pointer, then the corresponding select list item is not updated.

In format 2, the requested columns are set to the specified values for the row at the current row of the specified query. The columns do not need to be in the select list of the specified open cursor. This format can be PREPAREd.

Updating views

Updates are not allowed on cursors on views that have more than one table in the FROM clause.

Example

     UPDATE Employee
     SET emp_lname = 'Jones'
     WHERE CURRENT OF emp_cursor ;

Contents IndexUPDATE statement VALIDATE TABLE statement