antzjos Posted February 14, 2007 Share Posted February 14, 2007 Hi, Is it possible to dynamically add the where clause to the query depending on the parameter passed. I tried the following but did not work select colmn1, colmn2 from table1$P{CLAUSE1} I defined a parameter "CLAUSE" as string type and "PARAM" as Integer and assigned the value "where id="+$P{PARAM1} to the parameter "CLAUSE". Thanks Link to comment Share on other sites More sharing options...
mikemaze Posted February 14, 2007 Share Posted February 14, 2007 Have you tried a case statement? Link to comment Share on other sites More sharing options...
antzjos Posted February 14, 2007 Author Share Posted February 14, 2007 havnt tried it for this scenario yet, I can try case statement. thnx for the response. Link to comment Share on other sites More sharing options...
jmurray Posted February 14, 2007 Share Posted February 14, 2007 You need to use the exclamation mark to force inline insertion of a statement rather than a string. Say CLAUSE contains the text where id='200BA' select * from atable$P{CLAUSE}; would then result in the database engine seeing this: select * from atable "where id='200BA'"; Clearly wrong. But if you use the exclamation mark like this: select * from atable$P!{CLAUSE}; then the database engine will see this: select * from atable where id='200BA'; which is much more betterer.Post edited by: jmurray, at: 2007/02/14 02:39 Link to comment Share on other sites More sharing options...
antzjos Posted February 14, 2007 Author Share Posted February 14, 2007 Thanks much Murray. This worked. 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