Opps, I should have put ":" in front of p_my_parameter like
:p_my_parameter = '1' ...
Main Topics
Browse All TopicsHi there folks,
I was wondering if we can have the option of choosing at runtime from the report builder parameter so that if the end-user selects 'Yes' then the report will run one specific query and if he chooses 'No' then another particular query is invoked. What I mean to say that by choosing between Yes and No at runtime one should have the option of returning query results based on the same table but having different columns selected via the SELECT statement.
Thanks in advance
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
I just re-read your question and realized that you were talking about changing the actual columns selected. In that case, the first option I listed would not work but the second option would.
One more option is to use a Lexical reference. Here is an example from Reports Help:
SELECT &P_ENAME NAME, &P_EMPNO ENO, &P_JOB ROLE FROM EMP
P_ENAME, P_EMPNO, and P_JOB can be used to change the columns selected at runtime. For example, you could enter DEPTNO as the value for P_EMPNO on the Runtime Parameter Form. Note that in this case, you should use aliases for your columns. Otherwise, if you change the columns selected at runtime, the column names in the SELECT list will not match the Report Builder columns and the report will not run.
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:
Points to be given to ser6398
Please leave any comments here within the next seven days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
anand_2000v
EE Cleanup Volunteer
Business Accounts
Answer for Membership
by: ser6398Posted on 2002-05-20 at 09:11:07ID: 7021885
There are a few ways to do this.
One way is to code it into your select like:
select *
from my_table
where id = ....
AND
( (p_my_parameter = '1'
AND join1 = ...
)
OR
(p_my_parameter = '2'
AND join2 = ...
)
)
Another way is to simply create both select statements, create 2 separate layouts, then put a trigger on each of the layouts. One trigger (based on what the parameter is) will return TRUE and the other will return FALSE so only one layout/select will actually be visible.