你看这样是不是你需要的.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>

解决方案 »

  1.   

    好像和表2没有什么关系,凭啥ID=3的wlen写在下面啊?
      

  2.   

    select id,name,wlen,type from t_table1
    union all
    select id,name,null,decode(type,'0','1','0') from t_table1;
      

  3.   

    select b.id,a.wlen,b.type from t_table1 a ,
    ( 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我这个应该可以.
      

  4.   

    select b.id,a.wlen,b.type from t_table1 a ,
    ( 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少敲了个字母
      

  5.   

    SQL> Select a.Id,
      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>