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[m
qqq> [4mCOUNT[m qqqqqqqqq>qqqqqqqwqq>qqqqqqqqqqqqqqqqqqqqwqqqqqqqqqqqqqqqqk
mqq> handle-options qqqj x
x
lqqqqqqqqqqqqqqqqqqqqqqqqqqq<qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj
mqqq> [4mOF[m qqqqqqq> rse qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq>
(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
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.