SQL Programming Manual for Pascal
NonStop SQL Statements and Directives
HP NonStop SQL Programming Manual for Pascal—528614-001
3-38
Single-Row Update Operation
Single-Row Update Operation
A single-row update operation is a request to update a single row in a table. The 
following example updates a single row of the ORDERS table that contains information 
about order number 200038. The example declares the host variables :ORDERS and 
:NEWDATE, which serve as input variables in the UPDATE statement.
This example updates a single row of the ORDERS table that contains information 
about order number 200038. The code declares host variables for the columns of 
ORDERS and the host variable NEWDATE. These host variables serve as input 
variables in the UPDATE statement.
{ Variable declarations: }
EXEC SQL BEGIN DECLARE SECTION;
 TYPE
 ORDERS_TYPE = RECORD;
 ORDERNUM : INT32;
 ORDER_DATE : INT32;
 DELIV_DATE : INT32;
 SALESREP : INT16;
 CUSTNUM : INT16;
 END;
VAR ORDERS : ORDERS_TYPE;
 NEWDATE : INT16;
EXEC SQL END DECLARE SECTION ;
{ Procedure code: }
PROCEDURE UPDATE_ORDERS;
 BEGIN
 NEWDATE := 870522;
 ORDERS.ORDERNUM := 200038;
 EXEC SQL
 UPDATE ORDERS SET DELIV_DATE = :NEWDATE
 WHERE ORDERNUM = :ORDERS.ORDERNUM
 STABLE ACCESS;
 END;
The following statement updates only one row of the EMPLOYEE table because each 
value in EMPNUM is unique. EMPNUM is the primary key of the EMPLOYEE table:
EXEC SQL
UPDATE EMPLOYEE
 SET SALARY = 100000
 WHERE EMPNUM = 12345;
The following statement updates one row of the ORDERS table that contains 
information about order number 200038 and changes the delivery date:
EXEC SQL
UPDATE SALES.ORDERS SET DELIV_DATE = 880522
 WHERE ORDERNUM = 200038;










