你看这样是不是你需要的.SQL> Create Table T_Table1(Id Varchar2(5), Name Varchar2(5), vlen Varchar2(5),Typ Varchar2(5));表被创建SQL> Create Table T_Table2(typ Varchar2(5), typname Varchar2(10));表被创建SQL> Insert Into T_Table1 Values('1','1','10','0');1 行 已插入SQL> Insert Into T_Table1 Values('2','2','11','0');1 行 已插入SQL> Insert Into T_Table1 Values('3','3','12','1');1 行 已插入SQL> Insert Into T_Table2 Values('0','type1');1 行 已插入SQL> Insert Into T_Table2 Values('1','type2');1 行 已插入SQL>
SQL> Select a.Id, a.Name, Decode(Mod(Rownum, 2), '0', '', a.Vlen), a.Typ
2 From t_Table1 a, t_Table2 b
3 Order By a.Id
4 ;ID NAME DECODE(MOD(ROWNUM,2),'0','',A. TYP
----- ----- ------------------------------ -----
1 1 10 0
1 1 0
2 2 0
2 2 11 0
3 3 12 1
3 3 16 行 已选择SQL>
SQL> Select a.Id, a.Name, Decode(Mod(Rownum, 2), '0', '', a.Vlen), a.Typ
2 From t_Table1 a, t_Table2 b
3 Order By a.Id
4 ;ID NAME DECODE(MOD(ROWNUM,2),'0','',A. TYP
----- ----- ------------------------------ -----
1 1 10 0
1 1 0
2 2 0
2 2 11 0
3 3 12 1
3 3 16 行 已选择SQL>
union all
select id,name,null,decode(type,'0','1','0') from t_table1;
( select a.id,a.name,a.wlen,b.typ from t_table1 a,t_table2 b) b
where a.id(+)=b.id and a.wlen(+) = b.wlen and a.type(+) = b.type我这个应该可以.
( select a.id,a.name,a.wlen,b.type from t_table1 a,t_table2 b) b
where a.id(+)=b.id and a.wlen(+) = b.wlen and a.type(+) = b.type少敲了个字母
2 a.Name,
3 Decode(Mod(Rownum, 2), '0', '', a.Vlen),
4 Decode(Mod(Rownum, 2), 0, '0', '1') Type
5 From t_Table1 a, t_Table2 b
6 Order By a.Id, Type
7 ;ID NAME DECODE(MOD(ROWNUM,2),'0','',A. TYPE
----- ----- ------------------------------ ----
1 1 0
1 1 10 1
2 2 0
2 2 11 1
3 3 0
3 3 12 16 行 已选择SQL>