select a id1 from tab1 where id='' union all select b from tab1 where id='' union all select c from tab1 where id='' union all select d from tab1 where id='' union all select e from tab1 where id='' union all select f from tab1 where id='' union all select g from tab1 where id=''
楼主可建一临时表 CREATE GLOBAL TEMPORARY TABLE tmp (colname VARCHAR2(1), val INT);然后向其中插入数据(假设某数据表名为sometab,id值为someid)INSERT ALL INTO tmp VALUES('A',a) INTO tmp VALUES('B',b) INTO tmp VALUES('C',c) INTO tmp VALUES('D',d) INTO tmp VALUES('E',e) INTO tmp VALUES('F',f) INTO tmp VALUES('G',g) SELECT * FROM sometab WHERE id = someid;SELECT * FROM tmp;即可。
select b from tab1 where id='' union all
select c from tab1 where id='' union all
select d from tab1 where id='' union all
select e from tab1 where id='' union all
select f from tab1 where id='' union all
select g from tab1 where id=''
CREATE GLOBAL TEMPORARY TABLE tmp (colname VARCHAR2(1), val INT);然后向其中插入数据(假设某数据表名为sometab,id值为someid)INSERT ALL
INTO tmp VALUES('A',a)
INTO tmp VALUES('B',b)
INTO tmp VALUES('C',c)
INTO tmp VALUES('D',d)
INTO tmp VALUES('E',e)
INTO tmp VALUES('F',f)
INTO tmp VALUES('G',g)
SELECT * FROM sometab
WHERE id = someid;SELECT * FROM tmp;即可。