Greetings,
I have an application where I need to run a SQL query to fetch data, however, based on runtime condition, I need to use different SQL, this one is easy, I used "Function Body returning SQL Query".
e.g. if condition=1, I run SQL:
SELECT something FROM TABLE where condition=1;
if condition=2, I run SQL:
SELECT something FROM TABLE where condition=2;
But I also need the count, intuitively, I want:
SELECT something, count(*) over () INTO :P12_count FROM TABLE where condition=1;
SELECT something, count(*) over () INTO :P12_count FROM TABLE where condition=2;
Because I want to display :P12_count at the same time when page is rendered. Computation doesn't work, because it doesn't have "Function Body returning SQL Query" and I don't know which SQL will be run, and INTO :P12_count doesn't work.
How do I achieve that? Thank you so much!