'Im trying to replace IN Condition values from a context varibale in a query inside in a tOracleInput component. How to do that ?

Highlighted
One Star

'Im trying to replace IN Condition values from a context varibale in a query inside in a tOracleInput component. How to do that ?

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 . 

Twelve Stars

Re: 'Im trying to replace IN Condition values from a context varibale in a query inside in a tOracleInput component. How to do that ?

@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+)

Manohar B
Forteen Stars TRF
Forteen Stars

Re: 'Im trying to replace IN Condition values from a context varibale in a query inside in a tOracleInput component. How to do that ?

 

"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).


TRF
Forteen Stars TRF
Forteen Stars

Re: 'Im trying to replace IN Condition values from a context varibale in a query inside in a tOracleInput component. How to do that ?

@rathinTalend, did this help?

If so, thank's to mark your case as solved (Kudos also acceptedas a bonus).


TRF
Sixteen Stars

Re: 'Im trying to replace IN Condition values from a context varibale in a query inside in a tOracleInput component. How to do that ?

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.