請教高手
現在有幾個字段如下
 課程號  上課時間
  123     2009/1/8
  1234    2009/1/9
現在我想讓其顯示格式如下
課程號    123       1234
上課時間  2009/1/8  2009/1/9
不知該怎么解決??請指教...Thanks!

解决方案 »

  1.   

    補充:
    也就是像下面這樣的:
    轉換前:
    DM1 DM2 MC1 VAL 
    101 1 c1 100 
    101 1 c2 80 
    101 1 c3 40 
    101 2 c1 30 
    101 2 c2 80 
    102 4 c1 9 
    102 6 c2 50 转换后数据显示如下:DM1 DM2 c1 c2 c3 
    101 1 100 80 40 
    101 2 30 80   
    102 4 9     
    102 6   50 
      

  2.   

    用交叉表实现横向显示!
    例如:select 课程号,decode(课程号,'123',123),decode(课程号,'1234',1234)
    可显示成:课程号 123 1234楼主的排序方法有误、不规范!
    终止使用交叉表可实现表字段的横向显示,查查相关的资料,能够做出来的!
      

  3.   

    with tt as(select 101 DM1,1 DM2, 'c1'MC1,100 VAL  from dual 
    union all select 101,1,'c2',80 from dual 
    union all select 101,1,'c3', 40 from dual 
    union all select 101,2,'c1',30 from dual
    union all select 101,2,'c2',80 from dual
    union all select 102,4,'c1',9 from dual
    union all select 102,6,'c2',50 from dual) 
    select DM1,DM2,max(decode(MC1,'c1',VAL,0))C1, 
      max(decode(MC1,'c2',VAL,0))C2, 
     max(decode(MC1,'c3',VAL,0))C3 
    from tt
    group by DM1,DM2
      

  4.   

    http://topic.csdn.net/u/20100109/13/6a10c168-f190-4766-b838-adbf03c4ac7b.htmlrow_to_col('表名','dm1,dm2','mc1','val',colorder => 'mc1',roworder => '1,2');
      

  5.   

    謝謝!但是還是要請教下 在oracle中如何用execute呢??請指教!
      

  6.   

    在命令窗口使用execute 过程名;
    相当于begin 过程; end;