I am using jdbc to execute some sql queries. I have the following sql
sql="select distinct name, value from myTable1 union select distinct name, value from myTable2";
Problem: sometimes one of these tables doesn't exist and I get java error.
Error message: ORA-00942:table or view doesn't exist.
How to adjust the query to run table only if it exists.
UNIONshould have same number/datatype of columns selected from both tables.