Declares and opens a record stream. The undeclared START_STREAM statement: o Forms a record stream from one or more relations. The record selection expression determines the records in the record stream. o Places a pointer for that stream just before the first record in this stream. You must then use the FETCH statement to advance the pointer one record at a time through the stream and other RDML statements (for example, MODIFY and ERASE) to manipulate each record.
1 – Examples
The following programs: o Create a record stream, CURRENT_INF_STREAM, consisting of the CURRENT_INFO record sorted by highest salary first o Fetch the first record, thereby fetching the CURRENT_INFO record with the highest salary o Display a message about that record
1.1 – C Example
#include <stdio.h> DATABASE PERS = FILENAME "PERSONNEL"; main() { READY PERS; START_TRANSACTION READ_ONLY; START_STREAM CURRENT_INF_STREAM USING CI IN CURRENT_INFO SORTED BY DESC CI.SALARY; FETCH CURRENT_INF_STREAM; printf ("%s makes the largest salary!\n", CI.LAST_NAME); END_STREAM CURRENT_INF_STREAM; COMMIT; FINISH; }
1.2 – Pascal Example
program record_stream (input,output); DATABASE PERS = FILENAME 'PERSONNEL'; begin READY PERS; START_TRANSACTION READ_ONLY; START_STREAM CURRENT_INF_STREAM USING CI IN CURRENT_INFO SORTED BY DESC CI.SALARY; FETCH CURRENT_INF_STREAM; writeln (CI.LAST_NAME, ' makes the largest salary!'); END_STREAM CURRENT_INF_STREAM; COMMIT; FINISH; end.
2 – Format
(B)0[m[4mSTART_STREAM[m qqqwqq>qqqqqqqqqqqqqqqqqqwqqq> stream-name qqqqqqk mqq> handle-options qqj x x lqqqqqqqqqqqqqqqqqqqqqqqqqqqq<qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj x mqqqqqqqq> [4mUSING[m qqqq> rse qqqqwqqqqqqqqqqqqqqqwqqqqqqqqqq> mqq> on-error qqj (B)0[mon-error = [4mON[m [4mERROR[m qqwqqq> statement qqqqwqqq> [4mEND_ERROR[m mqqqqqqqqq<qqqqqqqqqj (B)0[mhandle-options = q> ( qwqqqqqq> [4mREQUEST_HANDLE[m qqqqq> var qqqqqqqqwq> ) q> tqqqqqq> [4mTRANSACTION_HANDLE[m qqq> var qqqqqqqqu mqqqqqq> [4mREQUEST_HANDLE[m q> var q> , qqqqqqqk x lqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj x mqqqq> [4mTRANSACTION_HANDLE[m q> var qqqqqqqqqqqj
2.1 – Format arguments
stream-name The stream that you create. The stream- name must be a valid operating system name. rse A record selection expression. A phrase that defines specific conditions that individual records must meet before Oracle Rdb includes them in a record stream. on-error The ON ERROR clause. Specifies host language statement(s) to be performed if an error occurs during the START_STREAM operation. For more information see the entry on ON ERROR. handle-options A request handle, a transaction handle, or both. REQUEST_HANDLE var The REQUEST_HANDLE keyword followed by a host language variable. A request handle identifies a compiled Oracle Rdb request. If you do not supply a request handle explicitly, RDML associates a unique request handle for the compiled request. TRANSACTION_HANDLE The TRANSACTION_HANDLE keyword followed by var a host language variable. A transaction handle identifies a transaction. If you do not supply a transaction handle explicitly, RDML uses the default transaction handle.