Hi,
I have a query similar to the one below:
SELECT 1 AS STRATEGIC_FLAG FROM TBL_A WHERE TBL_A.CODE = ? UNION SELECT 0 AS STRATEGIC_FLAG FROM TBL_B WHERE TBL_B.CODE = ?
Now, when I put in the inputs and then run the query in command center, I get the values as 1 and 0 in two separate rows as only two records match the condition.
Now when I use this query in Java, put it as a prepared statement and then get the result set, the result set always gives me 0 for both the rows. Even if both the records match the first condition and an output of 1 is expected, the result set gives 0.
I am using resultset.getString("STRATEGIC_FLAG")
When I SOP this, I get 0 for both the records.
Can anyone suggest as to what the problem is?
Regards,
Jumani