SQL/MX 3.x Query Guide (H06.22+, J06.11+)
SQL/MX Operators
HP NonStop SQL/MX Query Guide—640323-001
7-53
PACK Operator
ALTER TABLE table_a
ADD CONSTRAINT table_a_KEY FOREIGN KEY
(col1, col2) REFERENCES
table_b(col1, col2) on update restrict on delete restrict
DROPPABLE ;
CREATE TRIGGER table_a_Owner_Count
AFTER INSERT ON table_a
REFERENCING NEW AS newrow
FOR EACH ROW
UPDATE table_b SET owner_count = (
SELECT count(*) FROM table_a
WHERE (table_b.col1,table_b.col2)=
(table_a.col1,table_a.col2)
AND table_a.col3 = 1
)
WHERE (table_b.col1,table_b.col2)=
(newrow.col1,newrow.col2);
insert into table_b values('A', 1, 1, 0);
Prepare TestQuery11 from
insert into table_a values('A', 1, 1);
DESCRIPTION
fragment_id ............ 0
parent_frag ............ (none)
fragment_type .......... master
union_type ............... merge
PACK Operator
Rowset Group
Use the PACK operator in a query plan when selecting rows into rowset arrays:
SELECT <list> INTO <list of arrays> <body of query>
The PACK operator collects all the rows coming from the body of the query and puts
them into the arrays in the <list of arrays>. For more information about rowsets
and arrays, see the SQL/MX Programming Manual for C and COBOL.
The PACK operator has one child. The description field for this operator contains:
Token Followed by... Data Type
fragment_id A sequential number assigned to the fragment.
0 is always the master executor and 1 is
reserved for the EXPLAIN plan. Numbers 2 to n
will be ESP or DAM fragments.
integer










