Using OUTPUT FIRST

Use the OUTPUT FIRST WITHIN clause to return values at the start of timed or row count intervals.

INSERT INTO StockVolumeOut 
SELECT SUM(volume) 
FROM StockTrades 
KEEP EVERY 1 DAY 
OUTPUT FIRST WITHIN 10 SECONDS;

With OUTPUT FIRST WITHIN, the first row generated by the query is published and, concurrently, an interval starts. Both timed and row count intervals are permitted.

For timed intervals, all rows generated after the published row which starts the interval are then ignored, until the end of the interval. For row count intervals, the next N subsequent rows generated by the query are ignored where N is the number of rows specified in the OUTPUT FIRST WITHIN clause.

Once the interval has completed, the next row to be generated by the query is published, regardless of when it arrives. This starts a new interval and interval processing repeats as described above.


Created March 8, 2010. Send feedback on this help topic to Sybase Technical Publications: pubs@sybase.com