This is the question about JDBC. I have next task. I'm iterating through rows from table A and for some current row I want to execute some query against table B in context of current row from A. For example, if I have some query like
SELECT B.description FROM A LEFT JOIN B ON A.ID = B.refId
then I want to get all results where B.refId="current row from A".ID. Please, note that I cannot modify query for selecting results from B.
For example, let's table A like this:
ID name
1 nameA
2 nameB
and table B:
ID description refID
1 desc1 1
2 desc2 1
3 decs3 2
4 desc4 2
So if I for example on row from table A with ID 2 and perform my query then I want to get "desc3" and "desc4" only.
I suggest that this task can be solved with cursors but I'm familiar with it. Can anyone give me a hint?