SQL/MX Queuing and Publish/Subscribe Services
HP NonStop SQL/MX Queuing and Publish/Subscribe Services—523734-002
3-1
3 Embedded SQL Examples
As described in Section 2, Major Queuing Features, many of the queuing features can 
be executed within the SQL/MX conversational interface (MXCI). However, to ensure 
use of all the features, the queuing extensions are embedded in a program.
Note that queuing and publish/subscribe services are also supported in Java 
applications that contain embedded SQL/MX statements. For examples, see the 
SQL/MX Programming Manual for Java.
In the examples in this section, the DECLARE CURSOR statement specifies the WITH 
HOLD clause that defines the cursor as a holdable cursor. The cursor remains open 
and maintains its position in the result set even though a transaction might terminate 
following the fetch operation.
In addition to the WITH HOLD clause of the DECLARE CURSOR statement, this 
section provides embedded SQL examples of these features:
The examples in this section use the database in Appendix A, The Shipping Database. 
Note that the examples apply to both SQL/MP and SQL/MX tables, as described in 
Support for SQL/MP and SQL/MX Tables
 on page 1-5.
The routePackage function is assumed to be a function that results in the package 
being physically labeled with a bar code indicating the intermediate hub. 
Stream Access
 on page 3-2 Allows an application to access regular 
database tables as continuous data streams.
Embedded DELETE on page 3-3 Allows an application to select and delete rows 
in one statement execution.
Embedded UPDATE on page 3-4 Allows an application to select and update 
rows in one statement execution.
Skip Conflict Access on page 3-5 Allows an application to skip rows that are 
locked by a concurrent transaction.
Set Column Values on Rollback on 
page 3-6
Allows an application to update columns when 
aborting a transaction during an embedded 
DELETE or UPDATE operation.
Rowset Integration on page 3-7 Allows an application to enqueue or dequeue 
multiple rows at one time.
Join With a Stream on page 3-8 Allows an application to not materialize the 
intermediate result set of a join between a 
stream and the inner table of the join. 
Managing Transactions With the 
Stream Timeout Attribute on 
page 3-10
Allows an application to minimize the duration 
of transactions while the stream waits.










