SRW.SET_MAXROW
built-in procedureThis procedure sets the maximum number of records to be fetched for the specified
query. This is useful when your report formats (that is, displays) fewer records
than the query (or queries) that fetch them. Thus, with SRW.SET_MAXROW
,
you can conditionally restrict data that is fetched for your report, enabling
you to improve the report's performance.
SRW.SET_MAXROW (query_name CHAR, maxnum PLS_INTEGER);
Parameters |
Description |
query_name |
Is the query whose fetched records will be limited. |
maxnum |
Is maximum number of records you want the query to fetch. |
SRW.SET_MAXROW
is only meaningful in a Before Report trigger
(that is, after the query is parsed). If SRW.SET_MAXROW
is
called after the Before Report trigger (that is, after the queries have
been executed), the SRW.MAXROW_UNSET
packaged exception is
raised.
Because this procedure causes only the specified number of records to be fetched, the "unfetched" records of the query are not used in computations, and so on.
If you specify that 0 records should be fetched, the query will still be parsed.
You can also define the maxnum
parameter using the Reports
Builder user interface:
Property Inspector |
Set the Maximum Rows to Fetch property. |
Suppose your report has two queries, Q_Stocks and Q_Bonds. Suppose also, that
you have a user-created parameter, named WHICHDATA, that enables users to specify
which data they want the report to display: either stocks or bonds. In the Before
Report trigger, you could use the SRW.SET_MAXROW
procedure to ensure
that only one query's data is fetched:
FUNCTION FETCHIT RETURN BOOLEAN IS
BEGIN
if :whichdata != 1 then
srw.set_maxrow ('Q_Stocks', 0);
else
srw.set_maxrow ('Q_Bonds', 0);
end if;
RETURN (TRUE);
END;
About the
Reports Builder built-in package (SRW
)
Copyright © 1984, 2005, Oracle. All rights reserved.