I think the way you are getting data from 1 database based on the data from other databse is inefficient. First try to see if you can use the XA_Transaction and join the table between 2 databases?
If that apporach is not doable in your case then you can proceed as you are doing.
To proceed like this, do as follows:
1> query the first data base and get the returnList
2> Add a map step and there init a temp variable tempList with blank.
LOOP (over the returnList)
----Map step (set tempList with %templist%%returnList%,). Make sure the “Perform Variable substitution” Flag is checked.
After this LOOP add code to delete the last comma (which is extra) from returnList.
Now you can use this tempList in yo SQL as select … where IN(%tempList%). Make sure the “Perform Variable substitution” Flag is checked.