在PB中执行如下SQL,提示:不能在手动或分布事务方式下创建新的连接!我的语句:
declare cur_1 cursor for
select cus_code,pay_date from customer ;
open cur_1;
fetch cur_1 into :cuscode1,:date_1;
do while sqlca.sqlcode=0
......
tot_total1 = 0
select sum(total) into :tot_total1 from invoice where cus_code=:cuscode1 and date_build>:date_2 and date_build<=:date_3 ;
......
fetch cur_1 into :cuscode1,:date_1;
loop
close cur_1;得到的tot_total1 为 0,即select sum(total) into :tot_total1 from invoice...这句没执行!
按照这个错误信息查了一下,好像用SELECT时,和Cursor有关。
有人说:是你CURSOR没有关闭,然后又继续SELECT导致的,你可以先把SELECT的结果扔到数组里,关了CURSOR再循环再SELECT。
但我的数据要在CURSOR里再用SELECT得到合计数!不能关了CURSOR再循环再SELECT。
请问如何能执行select sum(total) into :tot_total1 from invoice...得到tot_total1的合计值?
declare cur_1 cursor for
select cus_code,pay_date from customer ;
open cur_1;
fetch cur_1 into :cuscode1,:date_1;
do while sqlca.sqlcode=0
......
tot_total1 = 0
select sum(total) into :tot_total1 from invoice where cus_code=:cuscode1 and date_build>:date_2 and date_build<=:date_3 ;
......
fetch cur_1 into :cuscode1,:date_1;
loop
close cur_1;得到的tot_total1 为 0,即select sum(total) into :tot_total1 from invoice...这句没执行!
按照这个错误信息查了一下,好像用SELECT时,和Cursor有关。
有人说:是你CURSOR没有关闭,然后又继续SELECT导致的,你可以先把SELECT的结果扔到数组里,关了CURSOR再循环再SELECT。
但我的数据要在CURSOR里再用SELECT得到合计数!不能关了CURSOR再循环再SELECT。
请问如何能执行select sum(total) into :tot_total1 from invoice...得到tot_total1的合计值?
解决方案 »
- oracle的sql语句
- number科学计数怎能么查询
- 急!!同一台机器9i可用,10g坏了,现在要重装10g,怎么办?不能损坏9i
- 一个2000左右人在线考试系统,同时提交试卷时就宕机了,怎么解决
- Oracle与SQL转换的问题
- 各位大哥大姐帮帮忙!!!!
- LGQDUCKY(飘) ,请再次过来接分。^^
- 我的硬盘装的windows2000,里面有oracle,怎样讲此硬盘放到别的电脑上,因为硬件不相同?
- org.hibernate.QueryParameterException: could not locate parameter [payStatus]
- dbca建库时出现 “Recovery Manager 无法恢复数据文件” 的错误
- 菜鸟提问:关于VIEW可否跨SCHEMA查询的问题,解决马上给分!
- 查询语句
fetch cur_1 into :cuscode1,:date_1;
do while sqlca.sqlcode=0fetch cur_1 into :cuscode1,:date_1;
loop
close cur_1;
其它的都一样!