2002 JI Open Discussion Posted August 19, 2006 Share Posted August 19, 2006 By: vivek srinivasan - viveksrinivasan dynamic parameters 2003-09-17 07:55 Hi, Is there any way i can specify parameters dynamically. Is there a way where in i can specify the begining date and end date in the query dynamically. exampl: select * from emp where beg_date>'09/12/2003' and end_date<'10/12/2003' The value of beginig date and end date will change each time i generate a report. Any help is appreciated. Vivek By: Arun Kumar PG - pgarunkumar RE: dynamic parameters 2003-09-22 23:00 Yes you can do this.Just pass the beg_date and end_date as parameter to your report at the runtime and specify the accepted parameters in the query.Thw query will look like this. <parameter name="bDate" isForPrompting="true" class="java.lang.String"> <parameter name="eDate" isForPrompting="true" class="java.lang.String"> SELECT * FROM EMP WHERE BEG_DATE>$P{bDate} && END_DATE<$P{eDate} PS: Do not include the qoutes in the query as we have already declared the Class as String for the two parameters. Try it! Cheers Arun By: Raul Carolus - thav RE: dynamic parameters 2003-10-24 11:53 Along the same lines, I want to put the whole where clause into a parameter. When i do this, with the parameter as a string, the SQL seems to be this: SELECT * FROM TABLE WHERE 'value < 32' And SQL chokes on this. What would I have to do to get rid of the single quotes around the parameter in the query? Thanks, Raul Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now