若条件=0则:select * from A表;
若条件=1则:select * from B表; ------最佳解决方案--------------------
--没有
--1、用动态sql
--2
if 条件1 then
select * from A;
else
select * from B;
end if;
------其他解决方案-------------------- 合意否?
WITH table1 AS
(
SELECT 'T1-A' AS st FROM dual
union all
SELECT 'T1-B' AS st FROM dual
),
table2 AS
(
SELECT 'T2-A' AS st FROM dual
union all
SELECT 'T2-B' AS st FROM dual
)
SELECT * FROM (
SELECT '0' AS FLG,T1.* FROM TABLE1 T1
UNION ALL
SELECT '1' AS FLG,T2.* FROM TABLE2 T2) WHERE FLG = '1'/*<-条件式*/
------其他解决方案--------------------
declare sqlstr varchar1(200);
若条件=0则:sqlstr:='select * from A表;';
若条件=1则:sqlstr:='select * from B表;';
execute immediate sqlstr ; ------其他解决方案--------------------