SQL/MX 3.2 Reference Manual (H06.25+, J06.14+)

SQL/MX Statements
HP NonStop SQL/MX Release 3.2 Reference Manual691117-001
2-322
MXCI Examples of UPDATE
INSERT INTO persnl.employee
(empnum, first_name, last_name, deptnum, salary)
VALUES (50, 'JERRY','HOWARD', 1000, 137000.00);
--- 1 row(s) inserted.
UPDATE persnl.dept
SET manager = 50
WHERE deptnum = 1000;
--- 1 row(s) updated.
COMMIT WORK;
--- SQL operation complete.
This transaction uses SERIALIZABLE access, which provides maximum data
consistency.
drop table test1;
create table test1(col1 int not null , col2 char(3),primary
key(col1) );
insert into test1 values ( 1, '100'), (2, '200');
--- 2 row(s) inserted.
prepare s1 from update test1 set col2 = '500' where col1 =
(select col1 from test1 where col1 > 1);
>>explain s1;
-------------------------------------------------------------
----- PLAN SUMMARY
MODULE_NAME .............. DYNAMICALLY COMPILED
STATEMENT_NAME ........... S1
PLAN_ID .................. 212204692377308695
ROWS_OUT ................. 1
EST_TOTAL_COST ........... 0.03
STATEMENT ................ update test1
set col2 = '500'
where col1 = (select col1 from
test1 where col1 >
1);
-------------------------------------------------------------
----- NODE LISTING
ROOT ====================================== SEQ_NO 11
ONLY CHILD 10
REQUESTS_IN .............. 1
ROWS_OUT ................. 1
EST_OPER_COST ............ 0
EST_TOTAL_COST ........... 0.03
DESCRIPTION
max_card_est ........... 1
fragment_id ............ 0
parent_frag ............ (none)
fragment_type .......... master