Library /sys$common/syshlp/RDOHELP72.HLB  —  PRINT
    Displays values from data records in a record stream on the
    current default output device. PRINT is intended for testing
    and learning. Using PRINT, you can type a query at the terminal
    and see the results immediately. You can also use the SET OUTPUT
    statement to write the results to a file or another output
    device.

    PRINT is valid only in RDO. To retrieve values in an RDBPRE
    program, use the GET statement to assign database values to host
    language variables.

    RDO Example:

    RDO>  FOR J IN JOBS
    cont>  PRINT J.JOB_CODE, J.JOB_TITLE
    cont> END_FOR

1  –  More

    If you have invoked a database, you have the necessary privileges
    to use the PRINT statement.

    You can use the PRINT statement in three ways:

    o  When you establish a record stream with the FOR or START_
       STREAM statement, you use the PRINT statement to write values
       from the current record stream to the output device. In the
       case of START_STREAM, you also need FETCH to indicate the
       current record in the stream.

    o  You can also use PRINT alone, without a FOR or FETCH
       statement, to retrieve the result of a statistical function.
       The record stream is formed by the record selection expression
       within the statistical expression.

    o  You can use PRINT...RDB$DB_KEY in a STORE...END_STORE block to
       display the database key of the record just stored. Example:

       RDO> STORE E IN EMPLOYEES USING
       cont>  E.EMPLOYEE_ID = "15231";
       cont>  E.LAST_NAME = "Smith";
       cont>   PRINT E.RDB$DB_KEY
       cont> END_STORE
                   RDB$DB_KEY
                     21:339:0

2  –  Format

  (B)0PRINT qqqwqwqqq> value-expr qqqqqqqqwqwqqq>
           x mqqq> context-var . * qqqj x
           mqqqqqqqqqqqqqq , <qqqqqqqqqqj

    Also see STORE syntax for example of using PRINT...RDB$DB_KEY in
    RDO within a STORE...END_STORE block.

2.1  –  value-expr

    A valid Oracle Rdb value expression. Request HELP on Value_expr for
    more information.

2.2  –  context-var

    A context variable you have defined in a FOR or START_STREAM
    statement. Use a context variable and a wildcard character (*)
    to display all the fields for each record in the record stream.
    If you use the wildcard character, RDO uses the field names as
    column headers on the display.

3  –  Examples

    Example 1

    Retrieve all the field values from one or more relations

    RDO> START_TRANSACTION READ_ONLY
    RDO>
    RDO>  FOR E IN EMPLOYEES
    cont>  PRINT E.*
    cont> END_FOR
    RDO>
    RDO> COMMIT

    You can use the wildcard character (*) to display all fields from
    one or more relations named in your RSE. RDO displays the names
    of the fields as column headers and displays the corresponding
    field values beneath them. When you use the wildcard character,
    you cannot display values for segmented strings, literals, or
    statistical expressions.

    This RDO query displays all the field values from each record in
    the EMPLOYEES relation.

    Example 2

    Retrieve values from named fields in a relation:

    RDO> START_TRANSACTION READ_ONLY
    RDO>
    RDO>  FOR E IN EMPLOYEES
    cont>  PRINT E.LAST_NAME, E.FIRST_NAME, E.MIDDLE_INITIAL
    cont> END_FOR
    RDO>
    RDO> COMMIT

    This RDO query displays field values from each record in the
    EMPLOYEES relation.

    Example 3

    Retrieve values from fields in two relations:

    RDO> START_TRANSACTION READ_ONLY
    RDO>
    RDO>  FOR E IN EMPLOYEES CROSS JH IN JOB_HISTORY
    cont>   OVER EMPLOYEE_ID
    cont>   WITH JH.JOB_END MISSING
    cont>   PRINT E.LAST_NAME, JH.JOB_CODE
    cont> END_FOR
    RDO>
    RDO> COMMIT

    This RDO statement performs a join of two relations and uses
    PRINT to display a value from each. The result is the last name
    and current job code of each employee.

    Example 4

    Retrieve the result of a statistical expression:

    RDO> START_TRANSACTION READ_ONLY
    RDO>
    RDO> PRINT COUNT OF E IN EMPLOYEES WITH
    cont> E.STATE = "MA"
    RDO>
    RDO> COMMIT

    This example retrieves the number of employees who live in
    Massachusetts.
Close Help