How to write SQL with dynamic parameter!!!!

:( Hi all!

I have some dynamic reports. I have a question like "
".... later. I want to make a report with one para. If I put a para by condition in the query. That is Ok. But I do not want to put a para into the query. it is error . :( . I used the same query in the forum. But it is error.
Please let me know how to write a dynamic query!!! :( .
Thanks advance!!!
Best regards!
Sorry! my Enghlish is not good!
loyalman's picture
Joined: Jul 19 2006 - 12:25pm
Last seen: 16 years 8 months ago

2 Answers:

If I understood correctly you want to use a parameter in a query. Add a parameter, say $P{pCity} and check "Is for Prompting" option.

Modify your query as:

Select * From Table Where $F{City}=$P{pCity}.

Hope this helps.
dprogrammer's picture
Joined: Jul 19 2006 - 7:37am
Last seen: 1 week 2 days ago

Hi ,

I also has the problem with dynamic parameter passing ,ok iwill explain

i want to get the data of a month so my query will be

select * from fruit where month(shiftdate)=10;

this will give me the needed result ,ok but if any date in that month eg:sundays are holidays so that day will be no data and also that date also missing i want that date also as in the date column ad the remain as 0.00,so i written a pgm in java to get alla the dates in a month and pass to the quey(not in report)as

select * from fruit where shiftdate=2009-10-04;

this is sunday so i get the output as sunday 0.0 0.0 in my java pgm but how can i pass the dates dynamically or is there any option other than this .I'm using ireport 3.0.0


Please help me


salishs's picture
Joined: Feb 3 2009 - 3:28am
Last seen: 14 years 1 month ago