I have a table like this:
ID | Name
------------
1 | AA
2 | AA
3 | AA
4 | BB
I want to select all rows where Name like 'AA'
in a cursor and get the count from this result in another cursor. I also need to page the results.
Expected result (Skip = 0; Take = 2)
-- p_result
ID | Name
------------
1 | AA
2 | AA
-- p_count
3
How can I do this?
Best Answer
An alternative to msi77's solution is the use of analytical functions. This might be a bit more efficient but you should run an explain plan to find out.