Jump to content
We've recently updated our Privacy Statement, available here ×

How to write SQL with dynamic parameter!!!!


loyalman

Recommended Posts

:( Hi all!

 

I have some dynamic reports. I have a question like "

(($F{NAME})==null?"SELECT * FROM CITIES;":"SELECT * FROM CITIES WHERE NAME ='London';
".... 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!

:cheer:

Note!

Sorry! my Enghlish is not good!

Link to comment
Share on other sites

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

  • 3 years later...

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

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...