Skip to content
Advertisement

offset with parameter in PL/SQL procedure

I have a PL/SQL procedure. It executes a SQL statement and returns a json responce.

I would like to limit the rows returned using the offset clause. eg:

However I don’t seem able to use variables to replace the 0 and the 25 in the example above.

Of course there are ways to work around this. I can write code like we had to before the offset clause appeared in 11g. But it looks ugly and possibly won’t perform as well….am I missing something. Can a parameter be used in the offset clause of SQL in a proc or cursor?

For example the following proc does compile but the cursor returned is always empty (its not when I hard code in values):

Advertisement

Answer

Like this:

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement