Declares a stream and is thereby able to associate a stream name with its RSE. This provides Oracle Rdb with the context needed to place the elements of the START_STREAM...FETCH...END_STREAM construct across a programming module in any order. Example: DECLARE_STREAM CURRENT_INFO_STREAM USING CI IN CURRENT_INFO SORTED BY DESCENDING CI.SALARY
1 – More
If you have invoked a database, you have the necessary privileges to use the DECLARE_STREAM statement. Use the DECLARE_STREAM statement in conjunction with the declared START_STREAM statement. The DECLARE_STREAM statement will not work in conjunction with the undeclared START_STREAM statement. Rdb recommends that all programs use the DECLARE_STREAM statement (with the declared START_STREAM statement) instead of the undeclared START_STREAM statement. The declared START_STREAM statement provides all the functions of the undeclared START_STREAM statement and provides more flexibility in programming than the undeclared START_STREAM statement. Put the DECLARE_STREAM statement before the associated declared START_STREAM, FETCH, and END_STREAM statements. The DECLARE_STREAM statement allows the use of fewer or more END_STREAM statements than START_STREAM statements within the same module, as long as at execution time exactly one END_STREAM statement is executed for each START_STREAM statement. RDO does not allow a record stream from which data values cannot be fetched by DBKEY (views that retrieve values from streams defined using the SQL GROUP BY or UNION clauses) to be declared or started. Such attempts produce the following exception: VWNOFETCH view 'view-name' cannot be fetched within a stream
2 – Format
(B)0[m[4mDECLARE_STREAM[m qwqqqqqqqqqqq>qqqqqqqqqwq> declared-stream-name qk mqq> handle-options qqj x lqqqqqqqqqqqqqqqqqqqqqqqqqq<qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj mqqqqqqqqqqqqqqqqqq> [4mUSING[m qqqqqqqqqq> rse qqqqqqqqqqqqqqqqqqqqqq>
2.1 – handle-options
(B)0[mhandle-options = qq> ( qwq> [4mREQUEST_HANDLE[m qqq> var qqqqqqqqqqqqqqqqqqqqqqqqqqqwq> ) qq> tq> [4mTRANSACTION_HANDLE[m qqq> var qqqqqqqqqqqqqqqqqqqqqqqu mq> [4mREQUEST_HANDLE[m q> var , [4mTRANSACTION_HANDLE[m q> var qj
2.1.1 – REQUEST_HANDLE
A keyword followed by a host language variable. A request handle points to the location of a compiled Oracle Rdb request. If you do not supply a request handle explicitly, Oracle Rdb associates a default request handle with the compiled request. You must use a request handle when you want to make an identical query to two different databases. In Callable RDO, use !VAL as a marker for host language variables. You can put parentheses around the host language variable name.
2.1.2 – TRANSACTION_HANDLE
A keyword followed by a host language variable. A transaction handle identifies each instance of a transaction. If you do not declare the transaction handle explicitly, Oracle Rdb attaches an internal identifier to the transaction. In Callable RDO, use !VAL as a marker for host language variables. You can put parentheses around the host language variable name. Normally, you do not need to use this argument. The ability to declare a transaction handle is provided for compatibility with other database products and future releases of Oracle Rdb.
2.2 – declared-stream-name
A name you give to the stream you declare. The stream name must be a valid OpenVMS name.
2.3 – rse
A record selection expression. A phrase that defines the specific conditions that individual records must meet before Oracle Rdb includes them in a record stream.
3 – Example
The following example declares a record stream named EMP_STREAM in RDO: RDO> DECLARE_STREAM EMP_STREAM USING cont> E IN EMPLOYEES SORTED BY E.LAST_NAME, E.FIRST_NAME