Asked • 03/18/19

Oracle BI Publisher, select different columns by parameter?

I'm just starting with Oracle BI Publisher and I really don't know how to get along with my task. My project is to ask the user for a parameter (that's ok), and if the user chooses 01, I should display ONLY 'january' with some data. If the user chooses 03, I should display 3 columns, 'january' 'february' 'march' with some data in each. I have all of the columns till december, I just don't know how to select different number of columns based on the given parameter. EDITED, ADDED CODE! declare p SYS_REFCURSOR; begin if (:month)=02 then open p for select 'bazisev' as evtipus, month-1 as month, january, february from db.tablename where month=(:month)-1 and sorszam between 4 and 15 union all select 'targyev' as evtipus, month, january, february from db.tablename where month=(:month) and sorszam between 4 and 15 union all select 'targyev/bazisev' as evtipus, month, january, february from db.tablename where month=(:month) and sorszam between 32 and 39 order by sorszam; elsif (:month)=01 then open p for select 'bazisev' as evtipus, month-1 as month, january from db.tablename where month=(:month)-1 and sorszam between 4 and 15 union all select 'targyev' as evtipus, month, january from db.tablename where month=(:month) and sorszam between 4 and 15 union all select 'targyev/bazisev' as evtipus, month, january from db.tablename where month=(:month) and sorszam between 32 and 39 order by sorszam; end if; end So right now i'm doing it like this with 2 months, but it says: ORA-00907: missing right parenthesis I'm pretty sure i have all the parenthesis i needed. Any suggesting?

1 Expert Answer

By:

CHADI E. answered • 07/10/19

Tutor
New to Wyzant

PhD in Systems Engineering with 8+ years expereince in Oracle SQL

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.