SQL SERVER 存储过程,转换成ORACLE存储过程
CREATEPROCEDURE[dbo].[getMaterialCC]@sumyearvarchar(50),@wellnamevarchar(50)ASBEGINse...
CREATE PROCEDURE [dbo].[getMaterialCC]
@sumyear varchar(50),
@wellname varchar(50)
AS
BEGIN
select ''+@sumyear+'' as 年月,c.countname as 分摊方式,d.departmentname as 库存地点,ROUND(SUM(a.sysl*a.dj),1) as 库存费用,ROUND(SUM(a.je),1) as 总费用 from Material_Cyz a left join costcounttype c on a.counttype=c.counttype left join Department d on a.kcdd=d.departmentid where SUBSTRING(a.ny,1,4)=@sumyear group by kcdd,c.countname,d.departmentname
END
这是sql server写的存储过程,执行此存储过程,结果是:
如何把此存储过程,转换为oracle存储过程,让结果同样是这样的? 展开
@sumyear varchar(50),
@wellname varchar(50)
AS
BEGIN
select ''+@sumyear+'' as 年月,c.countname as 分摊方式,d.departmentname as 库存地点,ROUND(SUM(a.sysl*a.dj),1) as 库存费用,ROUND(SUM(a.je),1) as 总费用 from Material_Cyz a left join costcounttype c on a.counttype=c.counttype left join Department d on a.kcdd=d.departmentid where SUBSTRING(a.ny,1,4)=@sumyear group by kcdd,c.countname,d.departmentname
END
这是sql server写的存储过程,执行此存储过程,结果是:
如何把此存储过程,转换为oracle存储过程,让结果同样是这样的? 展开
展开全部
CREATE OR REPLACE PROCEDURE GETMATERIALCC(sumyear varchar2,
wellname varchar2,
OUT_CUR OUT SYS_REFCURSOR) AS
STRSQL VARCHAR2(4000);
BEGIN
STRSQL := 'select ''' || sumyear || ''' as 年月,c.countname as 分摊方式,d.departmentname as 库存地点,
ROUND(SUM(a.sysl*a.dj),1) as 库存费用,ROUND(SUM(a.je),1) as 总费用 from Material_Cyz a
left join costcounttype c on a.counttype=c.counttype
改弊旦 left join Department d on a.kcdd=d.departmentid
where SUBSTR(a.ny,1,4)='''核扰 || sumyear ||
卜哪 ''' group by kcdd,c.countname,d.departmentname';
OPEN OUT_CUR FOR STRSQL;
END GETMATERIALCC;
今至电子科技有限公司
2024-08-23 广告
2024-08-23 广告
数据库备份是确保数据安全与业务连续性的关键环节。我们上海今至电子科技有限公司高度重视数据保护,定期执行全面的数据库备份策略。这包括使用先进工具和技术,对关键业务数据进行自动化备份,并存储在安全可靠的外部存储介质或云端。通过定期验证备份的完整...
点击进入详情页
本回答由今至电子科技有限公司提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询