我使用的是Delphi的ODAC控件连接的oracle数据库,其中有一个函数是插入数据的,采用的是事务提交的方式,没有使用触发器,但是经常使用一段时间以后,就会提示ora-01403:no data found的错误,重启一下程序就好了,之前在别的地方使用都是很正常的,就最近老是提示这个错误。
偶尔还会出现RA-01009: missing mandatory parameter错误,但是我的SQL语句都是正确的,也没有网上面说的什么字符集问题,怎么老是会出现这个错误。
请高手指点,谢谢
偶尔还会出现RA-01009: missing mandatory parameter错误,但是我的SQL语句都是正确的,也没有网上面说的什么字符集问题,怎么老是会出现这个错误。
请高手指点,谢谢
这么多分,看看就好了
这个错误 应该是你往某个变量里添加了空值
比如:select a init b from test;
a 在test表里是空的,那就会出现这个问题,当你调用这个函数的时候遇到空值才会出现这个问题
begin
to do sth;
exception
when no_data_found then
v_rate := 1;
end;
when no_data_found then
v_rate := 1;
end;
procedure TBasicDataKernel.ModifyUserGroupList(UserID:Integer;GroupList:TIntegerDynArray);
var
i,j:Integer;
c:TOraSession;
DevArr:TStringDynArray;
begin
c := LockConnection;
c.AutoCommit := False;
try
try
c.StartTransaction;
StrSql := 'delete from tab_user_group where User_ID=' + IntToStr(UserID);
ExecSql(StrSql,c);
StrSql := 'delete from tab_user_dev where User_ID=' + IntToStr(UserID);
ExecSql(StrSql,c);
if (Length(GroupList)>0) and (GroupList[0]<>-1) then
begin
for i := Low(GroupList) to High(GroupList) do
begin
DevArr := QueryDevIDsFromGroupID(GroupList[i]);
StrSql := 'insert into tab_user_group (User_ID,Group_ID) values (' + IntToStr(UserID) +
',' + IntToStr(GroupList[i]) + ')';
ExecSql(StrSql,c);
if (Length(DevArr)>0) and (DevArr[0]<>'') then
begin
for j := Low(DevArr) to High(DevArr) do
begin
StrSql := 'insert into tab_user_dev (User_ID,Dev_ID) values (' + IntToStr(UserID) +
',' + SafeSql(DevArr[j]) + ')';
ExecSql(StrSql,c);
end;
end;
end;
end;
c.Commit;
UpdateUserDevChange(c);
except
c.Rollback;
end;
finally
c.AutoCommit := True;
UnLockConnection(c);
end;
end;