录入预算报错时报错:
分析:这个错误是select into 语句返回多行的结果,但具体在哪?
两种方法查找,trace 或者debug
1.trace
启用调试
获取trace文件
-bash-3.2$ tkprof ERPDEV_ora_7532_RICK.trc $HOME/7532_rick.fchela.txt
TKPROF: Release 11.2.0.2.0 - Development on Mon Jul 28 11:21:34 2014
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
TKPROF: Release 11.2.0.2.0 - Development on Mon Jul 28 11:21:34 2014
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
分析trace文件
TKPROF: Release 11.2.0.2.0 - Development on Mon Jul 28 11:39:10 2014
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
Trace file: ERPDEV_ora_7532_RICK.trc
Sort options: default
********************************************************************************
count = number of times OCI procedure was executed
cpu = cpu time in seconds executing
elapsed = elapsed time in seconds executing
disk = number of physical reads of buffers from disk
query = number of buffers gotten for consistent read
current = number of buffers gotten in current mode (usually for update)
rows = number of rows processed by the fetch or execute call
********************************************************************************
SQL ID: ga9j9xk5cy9s0 Plan Hash: 467424113
select /*+ index(idl_sb4$ i_idl_sb41) +*/ piece#,length,piece
from
idl_sb4$ where obj#=:1 and part=:2 and version=:3 order by piece#
call count cpu elapsed disk query current rows
------- ------ -------- ---------- ---------- ---------- ---------- ----------
Parse 8 0.00 0.00 0 0 0 0
Execute 8 0.00 0.01 0 0 0 0
Fetch 22 0.01 0.15 12 66 0 14
------- ------ -------- ---------- ---------- ---------- ---------- ----------
total 38 0.01 0.17 12 66 0 14
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
Trace file: ERPDEV_ora_7532_RICK.trc
Sort options: default
********************************************************************************
count = number of times OCI procedure was executed
cpu = cpu time in seconds executing
elapsed = elapsed time in seconds executing
disk = number of physical reads of buffers from disk
query = number of buffers gotten for consistent read
current = number of buffers gotten in current mode (usually for update)
rows = number of rows processed by the fetch or execute call
********************************************************************************
SQL ID: ga9j9xk5cy9s0 Plan Hash: 467424113
select /*+ index(idl_sb4$ i_idl_sb41) +*/ piece#,length,piece
from
idl_sb4$ where obj#=:1 and part=:2 and version=:3 order by piece#
call count cpu elapsed disk query current rows
------- ------ -------- ---------- ---------- ---------- ---------- ----------
Parse 8 0.00 0.00 0 0 0 0
Execute 8 0.00 0.01 0 0 0 0
Fetch 22 0.01 0.15 12 66 0 14
------- ------ -------- ---------- ---------- ---------- ---------- ----------
total 38 0.01 0.17 12 66 0 14
...........
内容太多找不到出错点
用debug
分析保存时触发器执行顺序
(1)WHEN-V ALIDA TE-RECORD(将页面上的所有数据提交到数据库,若页面上有重复的数据,则提交
第一次时成功但只是将数据先写到数据库中一类似临时表的地方,在提交第二条重复记录的时候报错,执
行事务回滚,原来执行成功的指令也将被撤消)
(2) PRE-INSER T
(3) ON-INSER T
(4) POST-INSER T
(5) POST-FORMS-COMMIT
(6) PRE-BLOCK(BLOCK 级)
(7) KEY-COMMIT
(8) WHEN-NEW-ITEM-INST ANCE
做界面跟踪
好像是在WHEN-V ALIDA TE-RECORD 里面
备份AU_TOP下的fmb文件以及PA_TOP下的fmx文件
在form触发器里debug
发现不是 WHEN-V ALIDA TE-RECORD 里面
在pre-insert以及on-insert外层定位
FND_MESSAGE.DEBUG('validate');
matrix1.when_validate_record;
FND_MESSAGE.DEBUG('end validate');
matrix1.when_validate_record;
FND_MESSAGE.DEBUG('end validate');
FND_MESSAGE.DEBUG('on-insert');
matrix5.validate_resource_level;
FND_MESSAGE.DEBUG('on-insert -1');
matrix.insert_update_record;
FND_MESSAGE.DEBUG('end on-insert');
发现是在on-insert里面的matrix.insert_update_record;报错
做精确定位
找到问题,form被以前开发中修改过,取期间code时没加模块限制,返回多行数据
解决,加模块限制
matrix5.validate_resource_level;
FND_MESSAGE.DEBUG('on-insert -1');
matrix.insert_update_record;
FND_MESSAGE.DEBUG('end on-insert');
发现是在on-insert里面的matrix.insert_update_record;报错
做精确定位
if(:matrix_control.p1 is not null) then
--{
l_period_type_code := null;
fnd_message.debug(' insert_update_record 3');
fnd_message.debug(' :matrix_control.p1 3:'||:matrix_control.p1);
select period_type_code into l_period_type_code
from pa_budget_periods_v where period_name = :matrix_control.p1;
fnd_message.debug(' insert_update_record 4');
--{
l_period_type_code := null;
fnd_message.debug(' insert_update_record 3');
fnd_message.debug(' :matrix_control.p1 3:'||:matrix_control.p1);
select period_type_code into l_period_type_code
from pa_budget_periods_v where period_name = :matrix_control.p1;
fnd_message.debug(' insert_update_record 4');
找到问题,form被以前开发中修改过,取期间code时没加模块限制,返回多行数据
解决,加模块限制
--modify by cxy 2014-07-28
select period_type_code into l_period_type_code
from pa_budget_periods_v where period_name = :matrix_control.p1
and period_type_m = 'PA Period';
select period_type_code into l_period_type_code
from pa_budget_periods_v where period_name = :matrix_control.p1
and period_type_m = 'PA Period';