是否有任何(相同或替代的)方法将表名与DECODE函数一起使用。
如下所示:
SELECT * FROM
DECODE(FLAG,1,TABLE1,2,TABLE2,TABLE3)发布于 2014-04-08 14:23:43
在SQL中,不能在运行时确定表名。它们需要在编译时提供。
如果需要动态提供表名,则需要使用动态SQL。
希望能有所帮助
维沙德
发布于 2014-04-08 14:40:02
select * from table1 where decode(flag, 1,1, 0) = 1 union
select * from table2 where decode(flag, 2,1, 0) = 1 union
select * from table3 where decode(flag, 1,0, 2,0, 1) = 1;https://stackoverflow.com/questions/22928861
复制相似问题