免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2811 | 回复: 3
打印 上一主题 下一主题

update......where current of... [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2008-05-23 15:51 |只看该作者 |倒序浏览
foreach cur001 for
        select mkno_start_val, mkno_max_val, mkno_now_val
          into w_start_num , w_max_num , w_current_num
        from hulft_dt_f_mkno
        where hulft_id = p_hulft_id
        
        if  w_max_num  <  w_current_num  then
            let w_current_num = w_start_num;
            update hulft_dt_f_mkno
               set mkno_now_val  = w_current_num,
                   upd_date_time = w_time
             where current of cur001;
        end if
        exit foreach;
    end foreach;
以上代码编译没问题,可就是执行时回出-255的错。
希望高手指教!谢谢

论坛徽章:
11
金牛座
日期:2015-03-19 16:56:22数据库技术版块每日发帖之星
日期:2016-08-02 06:20:00数据库技术版块每日发帖之星
日期:2016-04-24 06:20:00数据库技术版块每日发帖之星
日期:2016-04-13 06:20:00IT运维版块每日发帖之星
日期:2016-04-13 06:20:00数据库技术版块每日发帖之星
日期:2016-02-03 06:20:00数据库技术版块每日发帖之星
日期:2015-08-06 06:20:00季节之章:春
日期:2015-03-27 15:54:57羊年新春福章
日期:2015-03-27 15:54:37戌狗
日期:2015-03-19 16:56:41数据库技术版块每日发帖之星
日期:2016-08-18 06:20:00
2 [报告]
发表于 2008-05-23 15:53 |只看该作者
-255    Not in transaction.

The database server cannot execute this COMMIT WORK or ROLLBACK WORK
statement because no BEGIN WORK was executed to start a transaction.
Because no transaction was started, you cannot end one. Any database
modifications that were made are now permanent; they cannot be rolled
back but do not need to be committed. Review the sequence of SQL
statements to see where the transaction should have started.

This error can occur when you open a cursor for update and have not started
a transaction yet.

论坛徽章:
0
3 [报告]
发表于 2008-05-23 16:14 |只看该作者

回复 #1 ymslx-2007 的帖子

谢谢啦,我也可以看到出错信息,就是不知道代码有那里写错啦。
如果各位有“where current of ”的用法发过来参考以下,不胜感激!!

论坛徽章:
0
4 [报告]
发表于 2008-05-28 14:27 |只看该作者
你把foreach cur001 for這行改成foreach cur001 with hold for
就可以執行了。
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP