I try to limit resultset in size without having to change each SQL statement from the app (at least for instance). So adding ROWNUM clause to every query is not an option.
I’m looking more or less for some global parameter, or at least a session parameter (like SET ROWCOUNT in SQLServer).
The app uses JDBC ressource pool to connect to Oracle, so I can set session-wide parameter in SQL init JDBC pool.
Have you tried using the Statement.setMaxRows method? That’s a standard JDBC approach that will silently drop rows after the specified maximum number have been fetched.
From a performance standpoint, however, you are likely better served by actually modifying the queries that are sent to the database. If you do as @MK suggests, you’ll be telling the optimizer that you’re only going to fetch N rows. That potentially allows the optimizer to pick a more efficient plan.