SQL$HELP72.HLB  —  UPDATE  Examples
    Example 1: Using the UPDATE statement in interactive SQL

    The following interactive SQL example changes the address of the
    employee with EMPLOYEE_ID 00164 and confirms the change:

    SQL> UPDATE EMPLOYEES
    cont>   SET ADDRESS_DATA_1 = '16 Ridge St.'
    cont>   WHERE EMPLOYEE_ID = '00164';
    1 row updated
    SQL> SELECT EMPLOYEE_ID, FIRST_NAME, LAST_NAME, ADDRESS_DATA_1
    cont>   FROM EMPLOYEES
    cont>   WHERE EMPLOYEE_ID = '00164';
     EMPLOYEE_ID   FIRST_NAME   LAST_NAME        ADDRESS_DATA_1
     00164         Alvin        Toliver          16 Ridge St.
    1 row selected

    Example 2: Using the UPDATE statement in a program

    The following example illustrates using a host language variable
    in an embedded SQL statement to update an employee's status code:

       DISPLAY "Enter employee's ID number: " WITH NO ADVANCING.
       ACCEPT ID.
       DISPLAY "Enter new status code: " WITH NO ADVANCING.
       ACCEPT STATUS-CODE.

    EXEC SQL
            DECLARE TRANSACTION READ WRITE
    END-EXEC

    EXEC SQL
            UPDATE EMPLOYEES
                    SET STATUS_CODE = :STATUS-CODE
                    WHERE EMPLOYEE_ID = :ID
    END-EXEC

    EXEC SQL  COMMIT  END-EXEC
Close Help