SQL Programming Manual for TAL
NonStop SQL Statements and Directives
HP NonStop SQL Programming Manual for TAL—527887-001
3-46
UPDATE
The example uses the host variables :NEW^PARTDESC, :NEW^PRICE, and 
:NEW^QTY and sets them to new values (entered by a user) for the columns before 
executing the UPDATE statement.
EXEC SQL DECLARE get_by_partnum_cursor CURSOR FOR
 SELECT partnum,
 partdesc,
 price,
 qty_available
 FROM sales.parts
 WHERE (partnum >= :starting^partnum )
 STABLE ACCESS
 FOR UPDATE OF partdesc,
 price,
 qty_available;
...
! Declare host variables new^partdesc, new^price,and new^qty.
...
! Get one row from the PARTS table:
EXEC SQL FETCH get_by_partnum_cursor .... ;
...
! Determine whether this is a row to be updated
...
! If the row is to be updated, assign update values to
! new^partdesc, new^price, and new^qty. If necessary,
! update the row at the current cursor position.
EXEC SQL UPDATE sales.parts
 SET partdesc = :new^partdesc,
 price = :new^price,
 qty_available = :new^qty
WHERE CURRENT OF get_by_partnum_cursor;










