EBcdOverflowException when calling Oracle stored procedure w

EBcdOverflowException when calling Oracle stored procedure w

Postby AlsyonTech » Thu 09 Oct 2008 11:18

Delphi 6
Oracle 9.2
dbexpoda.dll v4.20.0.11
--
With TSqlStoredProc (sp) component and stored procedure on Oracle,
when I use the following code, I get no error :

sp.params[0].Value := IntVal; (integer value)
sp.execproc; ---> OK

sp.params[0].AsString := StrVal; (string value)
sp.execproc; ---> OK



But, when I use any of the following codes, I get an "EBcdOverflowException" :


sp.params[0].AsInteger := IntVal; (integer value)
sp.execproc; ---> error

or

Params[0].DataType := ftInteger;
sp.params[0].Value := IntVal;
sp.execproc; ---> error

or

sp.parambyname('xxx').AsInteger := IntVal;
sp.execproc; ---> error



1- why does not it works with AsInteger ?

2- why this same code (i.e.: sp.params[0].AsInteger := IntVal;) works with Interbase and not with Oracle ?
AlsyonTech
 
Posts: 5
Joined: Thu 09 Oct 2008 07:48

Postby Plash » Fri 10 Oct 2008 07:18

You should take a look on the DataType property of parameter. Probably it is ftFmtBCD. With the TSQLStoredProc component you cannot change DataType of parameters. When you use the AsInteger property the DataType property is changed to ftInteger. This causes the problem.

So you should use the Value property to save original DataType.

With InterBase the DataType of the parameter is ftInteger initially.
Plash
Devart Team
 
Posts: 2844
Joined: Wed 10 May 2006 07:09

Postby AlsyonTech » Fri 10 Oct 2008 08:34

Thanks a lot Plash

That is also what I begun to understand while continuing my researchs.

What can I do to have the correct DataType and use AsInteger without exception with TSqlStoredProc ?
AlsyonTech
 
Posts: 5
Joined: Thu 09 Oct 2008 07:48

Postby Plash » Mon 13 Oct 2008 11:29

You can set the EnableBCD option for the Oracle driver to False.
Code: Select all
const
  coEnableBCD = TSQLConnectionOption(102);
begin
  SQLConnection1.Open;
  SQLConnection1.SQLConnection.SetOption(coEnableBCD, Integer(False));
end;
Plash
Devart Team
 
Posts: 2844
Joined: Wed 10 May 2006 07:09

Postby AlsyonTech » Tue 14 Oct 2008 08:30

This is a good solution.

Otherwise, the code : sp.params[0].AsInteger := IntVal
works without exception with Interbase because the DataType is already AsInteger in my code.
AlsyonTech
 
Posts: 5
Joined: Thu 09 Oct 2008 07:48

Postby AlsyonTech » Wed 15 Oct 2008 08:49

I have set the EnableBCD option for the Oracle driver to False.

The DataType of sp.params[0] is no more ftBCD :) , but now it is ftFloat :? which is not more correct.

What can I do ?
AlsyonTech
 
Posts: 5
Joined: Thu 09 Oct 2008 07:48

Postby AlsyonTech » Wed 15 Oct 2008 09:11

Sorry I made some more tests and when writing the code sp.params[0].AsInteger := IntVal
The DataType of params[0] becomes ftInteger as expected and ExecProc does not return any exception.

So, everything is ok :D. Thanks again Plash
AlsyonTech
 
Posts: 5
Joined: Thu 09 Oct 2008 07:48


Return to dbExpress driver for Oracle