Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Below is my query :
select name,
(SELECT a
FROM xyz
WHERE aaa=bbb
) "Lost/Not Present/Completed "
from table1
where name in ('a','b','c')
I have ('a','b','c') in my context variable "names" . how should i replace it. i tried in the sql builder using the below query
"select ...........
------------
where name in "+context.names
Im getting SQLSyntax exception. Is there any other way .
There is a further change that will be required so that the column alias does not screw up the Java String.....
"select name, (SELECT a FROM xyz WHERE aaa=bbb ) \"Lost/Not Present/Completed\" from table1 where name in (" + context.names + ")"
Since the column alias is in double quotes, you need to escape these with a \. This is because the SQL is actually a Java String.
@rathinTalend,can you try with below way.
select name,
(SELECT a
FROM xyz
WHERE aaa=bbb
) "Lost/Not Present/Completed "
from table1
where name in ( +context.names+)
"select name, (SELECT a FROM xyz WHERE aaa=bbb ) "Lost/Not Present/Completed " from table1 where name in (" + context.names + ")"
Beware of " to open and clode each part before/after the variable(s).
@rathinTalend, did this help?
If so, thank's to mark your case as solved (Kudos also acceptedas a bonus).
There is a further change that will be required so that the column alias does not screw up the Java String.....
"select name, (SELECT a FROM xyz WHERE aaa=bbb ) \"Lost/Not Present/Completed\" from table1 where name in (" + context.names + ")"
Since the column alias is in double quotes, you need to escape these with a \. This is because the SQL is actually a Java String.
Did this solution work for you?
Thanks rhall , i just found out the solution and forgot to post my answer over here. (Y) . Escape sequence did the trick