I was wondering if anyone could help me with a problem I have in ESQL
for Message Broker. I need to build up a database query dependant on
some esql variables. This can be done very easily in Java as you can
build up a string and pass it in as the query, however I dont know if
this is possible in ESQL.
An example in Java would be :-
qString = 'Select * from table1 where table1.col1=1';
if (var2!=null) {
qString = qString + ' and table1.col2= ' + var2;
}
if (var3!=null) {
qString = qString + ' and table1.col3= ' + var3;
}
Is there any way to accomplish a similar statement build in ESQL.
Many Thanks
Tim
Brian Meekings
Information Design, Inc - IBM Premier Partner
meek...@us.ibm.com
meek...@idi-middleware.com
Alternatively, you may write something like
SET Environment.myResultSet[] =
SELECT * FROM Database.table1 AS D
WHERE D.col1=1
AND ((Environment.var2 IS NOT NULL) AND D.col2 = Environment.var2)
AND ((Environment.var3 IS NOT NULL) AND D.col3 = Environment.var3);