otFloat bind variable causes ORA-01401 error

MarkR

Member²
I am using Delphi 4, DOA 3.3.1 and Oracle 7.3. I have a table with a column of type NUMBER(12,2) and the bind variable "pc" is used to insert data into that column. Using a TOracleQuery component, I am trying to run a query like this:

with DM.oqryClaims do
begin
Close;
SQL.Clear;
DeleteVariables;
DeclareVariable('fn', otString);
DeclareVariable('rd', otDate);
DeclareVariable('pc', otString);
DeclareVariable('pdl', otInteger);
DeclareVariable('pnl', otInteger);
DeclareVariable('rl', otInteger);
DeclareVariable('pl', otInteger);
DeclareVariable('pc', otFloat);
SQL.Add('INSERT INTO CTS.CLMREMIT VALUES (:fn, :rd, :pc, :pdl, :pnl, ' +
':rl, :pl, :pc )');
SetVariable('fn', FileName);
SetVariable('rd', RunDate);
SetVariable('pc', PayCycle);
SetVariable('pdl', PaidLines);
SetVariable('pnl', PendLines);
SetVariable('rl', RejectLines);
SetVariable('pl', PLines);
SetVariable('pc', 68.42);
try
Execute;
exception
{Exception code here}
end;
end;

Whether I use a variable of type Real or specify a value like above, I get the ORA-01401 error - inserted value too large for column. I do not get this error if I insert NULL or 0. How can this happen when I try to insert 68.42 into a NUMBER(12,2) column? If I use SQL*PLUS and run this insert statement it works fine.

Is there a problem caused by DOA translating this value to a floating point type where there are more than 2 places to the right of the decimal? Please let me know if this is a DOA issue or not and what I can do to deal with this situation.

Thanks.
 
I'm not sure if this is the cause of the problem, but I noticed 2 pc variables in your query. First it's declared as a string, and later as a float.

------------------
Marco Kalter
Allround Automations
 
Thanks, Marco. I guess I just wasn't awake enough to notice that, but neither were the 2 other developers in my office that looked at the code before I posted this item.
 
Back
Top