oracle 中 java.sql.SQLException: ORA-01002: 提取违反顺序

_飞飞飞上天 2012-12-10 09:54:07
在一个流程中设置了一个机器人节点,目的是:审批结束后,通过update语句,将表单中的一些内容更新到数据库person_info_t的表中,并将更新前后的值记录到新表info_update_record中。机器人节点中的sql语句,红色表示变量
update person_info_t set fd_work_phone_ext=:workphoneext, fd_mobile_no_office=:mobilenooffice, pad_mac=:mac , computer_name=:computer,tmp_type=1 where fd_login_name=:uname;
--tmp_type=0或者=1是记录数据来源,因为update可能来自两种操作,流程是一种,通讯录更新是另外一种,通讯录更新时,不会更新tmp_type的值
Person_info_t 部分字段:

在person_info_t的表中,创建了一个trigger,当发生update时,触发,语句如下:
create or replace trigger mac_update_trig
before update or insert
on person_info_t
for each row
when ( new.pad_mac <> old.pad_mac or new.computer_name <> old.computer_name or new.fd_work_phone_ext <> old.fd_work_phone_ext or new.fd_mobile_no_office <> old.fd_mobile_no_office )
declare
pre varchar2(50);
aft varchar2(50);
date_now date := sysdate;
uname varchar2(50);
Begin
--对于不同的update,对info_update_record进行insert,分别记录
uname := :old.fd_login_name;
if (:new.pad_mac <> :old.pad_mac) then
pre := :old.pad_mac;
aft := :new.pad_mac;
insert into info_update_record
values
(uname, date_now, 'pad_mac', pre, aft, :new.tmp_type);
end if;
if (:new.computer_name <> :old.computer_name) then
pre := :old.computer_name;
aft := :new.computer_name;
insert into info_update_record
values
(uname, date_now, '计算机名', pre, aft, :new.tmp_type);
end if;
if (:new.fd_work_phone_ext <> :old.fd_work_phone_ext) then
pre := :old.fd_work_phone_ext;
aft := :new.fd_work_phone_ext;
insert into info_update_record
values
(uname, date_now, '分机号码', pre, aft, :new.tmp_type);
end if;
if (:new.fd_mobile_no_office <> :old.fd_mobile_no_office) then
pre := :old.fd_mobile_no_office;
aft := :new.fd_mobile_no_office;
insert into info_update_record
values
(uname, date_now, '集团号', pre, aft, :new.tmp_type);
end if;
--重置tmp_type值为0
:new.tmp_type := 0;
end;
info_update_record 全部字段:


报错部分:

java.sql.SQLException: ORA-01002: 提取违反顺序

以上update直接在plsql下操作是可以通过的,例如
update person_info_t set pad_mac ='123456789',tmp_type=1 where fd_login_name='guoxing_lu'

问题挺揪心的,弄个好几天了,求大侠帮助
...全文
822 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
linwaterbin 2012-12-10
  • 打赏
  • 举报
回复
ORA-01002: fetch out of sequence Cause: This error means that a fetch has been attempted from a cursor which is no longer valid. Note that a PL/SQL cursor loop implicitly does fetches, and thus may also cause this error. There are a number of possible causes for this error, including: 1) Fetching from a cursor after the last row has been retrieved and the ORA-1403 error returned. 2) If the cursor has been opened with the FOR UPDATE clause, fetching after a COMMIT has been issued will return the error. 3) Rebinding any placeholders in the SQL statement, then issuing a fetch before reexecuting the statement. Action: 1) Do not issue a fetch statement after the last row has been retrieved - there are no more rows to fetch. 2) Do not issue a COMMIT inside a fetch loop for a cursor that has been opened FOR UPDATE. 3) Reexecute the statement after rebinding, then attempt to fetch again

17,377

社区成员

发帖
与我相关
我的任务
社区描述
Oracle 基础和管理
社区管理员
  • 基础和管理社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧