HELPLIB.HLB  —  RDML72  Statements  COUNT
    Returns the number of records in a record stream specified by
    a record selection expression. The COUNT function differs from
    other statistical functions because it operates on the record
    stream defined by the record selection expression rather than on
    the values in that record stream.

1  –  Examples

    The following programs demonstrate the use of the COUNT function
    in a display statement. These programs:

    o  Use the COUNT function to compute the number of records stored
       in the EMPLOYEES relation

    o  Print an informational message and this computed number

1.1  –  C Example

    #include <stdio.h>
    DATABASE PERS = FILENAME "PERSONNEL";

    int num;
    main()
    {
    READY PERS;
    START_TRANSACTION READ_ONLY;

    GET
       num = COUNT OF E IN EMPLOYEES;
    END_GET;

    printf ("The number of employees is %d", num);

    COMMIT;
    FINISH;
    }

1.2  –  Pascal Example

    program display_count (input,output);
    DATABASE PERS = FILENAME 'PERSONNEL';

    var
    num : integer;

    begin
    READY PERS;
    START_TRANSACTION READ_ONLY;

    GET
      num = COUNT OF E IN EMPLOYEES;
    END_GET;

    writeln ('The number of employees is', num);

    COMMIT;
    FINISH;
    end.

2  –  Format

  (B)0
  qqq> COUNT qqqqqqqqq>qqqqqqqwqq>qqqqqqqqqqqqqqqqqqqqwqqqqqqqqqqqqqqqqk
                              mqq>  handle-options qqqj                x
                                                                       x
   lqqqqqqqqqqqqqqqqqqqqqqqqqqq<qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj
   mqqq>  OF  qqqqqqq>  rse  qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq>

  (B)0handle-options =

  q> ( qwqqqqqq>  REQUEST_HANDLE  qqqqq>  var qqqqqqqqwq> ) q>
        tqqqqqq> TRANSACTION_HANDLE qqq>  var qqqqqqqqu
        mqqqqqq> REQUEST_HANDLE q> var q> , qqqqqqqk  x
          lqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj  x
          mqqqq> TRANSACTION_HANDLE q> var qqqqqqqqqqqj

2.1  –  Format arguments

    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.

    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.
Close Help