lofidevops
lofidevops

Reputation: 17032

Can I use named parameters in BIRT queries?

I am writing queries for reports using Eclipse/BIRT. At the moment I create a query with ? characters for parameters, and I can then assign values to the parameters under the parameter tab.

However, if I need to assign the same value multiple times, I have to do this multiple times, once for each appropriate ?. Additionally, this system is fragile - if I add a question mark in the middle of the query, I need to adjust and reorder the list of parameters.

Is there a way to use named parameters rather than question marks in the original query?

Upvotes: 4

Views: 5108

Answers (1)

MrRaymondLee
MrRaymondLee

Reputation: 536

BIRT query doesn't support named parameters but if database supports WITH statement, you can do what is illustrated here:

http://enterprisesmartapps.wordpress.com/2011/01/10/re-using-parameters-in-birt-data-set/

Basically, you're query becomes:

WITH
params AS
(SELECT ? AS year FROM dual)
SELECT * FROM tab1, params WHERE year = params.year
UNION
SELECT * FROM tab2, params WHERE year = params.year

Then you can set the ? once.

Upvotes: 4

Related Questions