Infolinks

Saturday 21 July 2012

srw-set_maxrow

Description  This procedure sets the maximum number of records to be fetched for the specified query.  This is useful when your report formats (i.e., 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.
Syntax
SRW.SET_MAXROW (query_name CHAR, maxnum PLS_INTEGER);
Parameters
query_name   Is the query whose fetched records will be limited.
maxnum         Is maximum number of records you want the query to fetch.
Property Palette  To define this attribute using the Property Palette, set the Maximum Rows to Fetch property.
Restrictions
·         SRW.SET_MAXROW is only meaningful in a Before Report trigger (i.e., after the query is parsed).  If SRW.SET_MAXROW is called after the Before Report trigger (i.e., 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, etc.
·         If you specify that 0 records should be fetched, the query will still be parsed.
Example
/* 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;

No comments:

Post a Comment