不能那样写,但是可以这样写 cursor xx is SELECT case a when 1 then t1.field1, t1.field2, t1.field3...t1.fieldn when 2 then t2.field1, t2.field2, t2.field3...t2.fieldn ELSE NULL END FROM table1 t1, table2 t2
有个办法,比较麻烦, 建一个临时表table3 like table1 if (a=1) then insert into table3 select * from table1; elsif (a=2) then insert into table3 select * from table2; end if;