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!

How to dynamically filter column names in SQL statement?

Blue BirdJan 18 2018 — edited Jan 22 2018

Hello,

I need some help and suggestions with creating SQL statements. In APEX 5.x I'm creating Stacked column charts with multiple series.

My SQL looks like below:

Select

   Null,

   Label,

   Series1Value,

   Series2Value,

   ...

From TableName

Where Criteria

On the top of the chart I would like to have Region with criteria selection where user can choose which columns (series) will be visible on the chart. Can I somehow write only one universal SQL which will then regarding to selected series on the top, show only that series and hide others? I have in mind some simple approach if is possible, something similar like you can write in Where clause, except that I will use this in Select clause with columns.

If user for example choose Series2 only then SQL will look like "Select, Null, Label, Series2Value From Table Name ...". If select Series1 and Series3 SQL will be composed like "Select, Null, Label, Series1Value, Series3Value From Table Name ...", etc.

I don't came on mind with any good idea at the moment and I'm not sure if you can do that at all. I hope I explain clearly enough what I want to implement. Thanks for any help.

BB

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 19 2018
Added on Jan 18 2018
8 comments
1,319 views