I saw a similar question for SqlDB but after
One could consider an alternative to the repeated query in your procedure. For example:
CREATE OR REPLACE
PROCEDURE SPGETRESULTANDSETFLAG
(
pFilter VARCHAR2,
pTableID RAW,
myCursor OUT types.cursorType
)
AS
DataQuery VARCHAR(20000) := '';
BEGIN
DataQuery := 'SELECT COUNT(*) OVER () AS TheCount, T.* FROM '
|| F_GET_TABLENAME_FROM_ID(PTABLEID => pTableID)
|| ' AS T WHERE ' || pFilter;
--Get the Return Cursor
Open myCursor for DataQuery;
END SPGETRESULTANDSETFLAG;
In this way you don't have to query the table twice, you have the count in each row of your resultset. You can get rid of your parameters dealing with the max rowcount as well, and check the count value in your calling routine by fetching one row.
Just an alternative thought...