please someone help me. I want to convert this query from mybatis to ORACLE
SELECT *
FROM TABLE_A
<if paramA is not null>
, ( SELECT *
FROM TABLE_B
) B
</if>
WHERE ....
<if paramA is not null>
A.key = B.key
</if>
i'm currently stuck at that IF tag inside FROM.
Oracle does not allow you to conditionally include tables.
One option may be to always join
TABLE_Band filter on the parameter (as a bind parameter) in the join condition:It is not quite the same as, when the
:paramAbind variable isNULLthen theTABLE_Bcolumns will be included in the output but the values of thoseTABLE_Bcolumns will all beNULL.