Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Set Value for page item that returned by "Function Body returning SQL Query"

Larry HSep 3 2022

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!

This post has been answered by Ananya Chatterjee-Oracle on Sep 3 2022
Jump to Answer
Comments
Post Details
Added on Sep 3 2022
2 comments
692 views