DTW_SET_TOTAL_ROWS

AIX HP-UX Linux OS/2 OS/390 OS/400 PTX SUN Win NT
X X X X X X X X X

Purpose

Specifies to a database language environment that the total number of rows in the result set for a query should be assigned to TOTAL_ROWS.

Specify the value of this variable using a DEFINE statement or with the @DTW_ASSIGN() function.

OS/400, OS/2, Windows NT, and UNIX users: To pass this variable to the language environment, include it as an IN variable in the database language environment's ENVIRONMENT statement in the Net.Data initialization file. See the configuration chapter of Net.Data Administration and Programming Guide to learn more about the database language environment statement.

OS/390 users: DTW_SET_TOTAL_ROWS is implicitly passed to the database language environments when it is defined in the macro.

Performance tip: Setting DTW_SET_TOTAL_ROWS to YES affects performance because to determine the total rows, the database language environment requires that all rows be retrieved.

Values

DTW_SET_TOTAL_ROWS="YES"|"NO"

Table 15. DTW_SET_TOTAL_ROWS Values
Values Description
YES Assigns the value of the total number of rows to the TOTAL_ROWS variable. Important: You must set this value if you want to reference the variable TOTAL_ROWS to determine the number of rows returned from a query.
NO Net.Data does not set the TOTAL_ROWS variable and TOTAL_ROWS cannot be referenced in a macro. NO is the default.

Examples

Example 1: Defines DTW_SET_TOTAL_ROWS for using TOTAL_ROWS

%DEFINE DTW_SET_TOTAL_ROWS="YES"
 
...
 
%FUNCTION (DTW_SQL) myfunc() {
select * from MyTable
%report {
...
%row
...
%}
<p>Your query is limited to $(TOTAL_ROWS) rows.  The query returned too many rows.
%}
%}


[ Top of Page | Previous Page | Next Page | Index ]