ymslx-2007 发表于 2008-05-23 15:51

update......where current of...

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
      
      ifw_max_num<w_current_numthen
            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的错。
希望高手指教!谢谢

liaosnet 发表于 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.

ymslx-2007 发表于 2008-05-23 16:14

回复 #1 ymslx-2007 的帖子

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

mush57 发表于 2008-05-28 14:27

你把foreach cur001 for這行改成foreach cur001 with hold for
就可以執行了。
页: [1]
查看完整版本: update......where current of...