I have been challenged on selecting on different tables based on a parameter.
My question will be pretty much similar to this, but here is my case:
Say I have a parameter list from the front end [1,2,3,4]
And based on this parameter, how can I do select on the different tables on an sql?
In Java, I can do:
StringBuffer sql = new StringBuffer();
if ( parameter == 1)
sql.append("Select * from TABLEA");
else if ( parameter == 2)
sql.append("Select * from TABLEB");
else if ( parameter == 3)
sql.append("Select * from TABLEC");
else if ( parameter == 4)
sql.append("Select * from TABLED");
How can I do this on SQL itself?
In
Oracle PLSQL, you can do it somewhat like this: