create procedure SUNGZXS @SDATE datetime,@EDATE datetime,@TSDATE datetime,@TEDATE datetime
as
begin
if (select object_id("#A")) is not null drop table #A
if (select object_id("#B")) is not null drop table #B
TRUNCATE TABLE SHLSBB
select DEPTID,sum(XSJE) XSJE,sum(XSBS) XSBS into #A from GZXS_HIS
where JZRQ>=@SDATE and JZRQ<=@EDATE and DEPTID like '10060602%' group by DEPTID
select DEPTID,sum(XSJE) TQXS,sum(XSBS) TQBS into #B from GZXS_HIS
where JZRQ>=@TSDATE and JZRQ<=@TEDATE and DEPTID like '10060602%' group by DEPTID
INSERT INTO SHLSBB (DEPTID,XSJE,XSBS,TQXS,TQBS)
select * FROM
(SELECT #A.DEPTID,XSJE,XSBS,TQXS,TQBS FROM #A LEFT JOIN #B ON #A.DEPTID=#B.DEPTID
union all
SELECT #A.DEPTID,XSJE,XSBS,TQXS,TQBS FROM #A RIGHT JOIN #B ON #A.DEPTID=#B.DEPTID) #A
end
PB中调用如下:
DECLARE P_1 PROCEDURE FOR SUNGZXS @SDATE = :sd , @EDATE = :ed ,@TSDATE = :sdt , @TEDATE = :edt ; @DEPTID = :gbid ;
execute P_1;
FETCH P_1 INTO :sd,:ed,:sdt,:edt:gbid;
commit using sqlca;
close P_1;
该存储过程在SQL中运行正常,在PB中执行后无结果,请各位指点一二,感谢
1 个解决方案
#1
可以参考一下下面这个:
https://www.cnblogs.com/powerbuilder/archive/2011/11/18/2254322.html
https://www.cnblogs.com/powerbuilder/archive/2011/11/18/2254322.html
#1
可以参考一下下面这个:
https://www.cnblogs.com/powerbuilder/archive/2011/11/18/2254322.html
https://www.cnblogs.com/powerbuilder/archive/2011/11/18/2254322.html