SQL/MX Queuing and Publish/Subscribe Services
Major Queuing Features
HP NonStop SQL/MX Queuing and Publish/Subscribe Services—523734-002
2-8
AFTER LAST ROW
If a third application enqueues an invoice, either the first or second application can 
dequeue the new invoice:
CONTRACTNBR AMOUNT PRIORITY 
----------- ----------- ----------- 
 500 55000 5 
Note that if the second application did not use skip conflict access, it would not be able 
to access this new invoice, because it would be waiting on a locked row and therefore 
would eventually time out:
SELECT * FROM 
 (DELETE FROM STREAM(invoices)) AS invoices;
*** ERROR[8551] Error 73 was returned by the Distribution 
Service on \TESTSYS.$DB.PUBS.INVOICES.
--- 0 row(s) selected. 
For an example of using skip conflict access for the cursor specification in an 
application, see Skip Conflict Access on page 3-5.
AFTER LAST ROW
When a statement that selects from a stream begins executing, it returns rows that 
already exist in the table as well as rows that are inserted or updated in the table after 
the statement begins executing. For some applications, it is necessary to select only 
newly published rows, not existing rows, from the stream. 
When you use the AFTER LAST ROW clause with a stream table specification, the 
statement does not read rows that existed in the table when the statement began 
executing, but only returns a row if it was inserted or updated after the statement 
began executing. 
This behavior can be useful if the subscriber is not interested in the rows that were 
published while it was not subscribing. For example, the subscriber could be involved 
in real-time fraud detection, monitoring scans of items by a cashier so that the 
application can take immediate action. In such a case, items scanned in the past would 
be of no interest. 
Alternatively, the application might be managed in a way that prevents publishing while 
the subscribers are inactive. The operator could first shut down the publishing 
processes and then shut down the subscribers after they have timed out (see Stream 
Timeout Attribute on page 2-3). To restart the application, the operator would always 
start the subscribers before the publishers. 
Using Scenario 1. The Quotes Channel (page B-2), if you want the application to see 
only quotes published after the SELECT statement began executing, you would 
include the AFTER LAST ROW clause in its syntax:
SELECT * FROM STREAM(quotes) AFTER LAST ROW;










