标题:ms sql到oracle sql的转换
取消只看楼主
samchew
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2009-8-17
结帖率:0
已结贴  问题点数:20 回复次数:0 
ms sql到oracle sql的转换
请大家帮帮忙,把下面的sql语句转换成能在oracle下面跑的,此语句在ms sql server下编译无误,请大家帮个忙,急,在线等,万分感谢!



declare @sql varchar(8000)
set @sql = 'select (case when grouping(t2.itemname)=1 then ''总计'' else t2.itemname end) as itemname,'
select @sql = @sql+ ' sum(case when TRANSACTID= '+TRANSACTID+' then 1 else 0 end) as ['+TRANSACTID+'],'
From (Select Distinct TRANSACTID From C_ACCEPT_STATUS) T
set @sql = left(@sql,len(@sql)-1)+',(case when count(1)=0 then ''0'' else count(*) end) as ''总计''
      from WORKAPPLY t left join C_ADMIN_ITEM t2
        on t.itemid=t2.itemcode  group by t2.itemname with rollup'
exec(@sql)
搜索更多相关主题的帖子: ORACLE SQL 
2009-08-17 09:27



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-282960-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.948745 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved