Returning 64 bit integers from Oracle Package functions..

Hello,
I am having trouble returning large integer values from Oracle package functions using direct oracle access and the package wizard.

For example, I made this test:

procedure Test
(
Param1 out Integer
) is
begin
Param1 := 9223372036854775808;
end Test;

The package wizard interprets Integer as a float and uses the Double data type in Delphi (as I guess underneath an Integer in Oracle == Number(38)) and even if I could get past the wrongness of "storing an integer in a float data type", a double doesn't have enough significant digits to represent large 64 bit numbers anyway. If I tell the package wizard to use variants, it just returns a double in a variant. I'd like something like PLS_INTEGER, which the wizard uses otInteger for, but this is only 32 bits..

Thanks for any info/help,
David
 
The Package Wizard will only use Integer or Double for numeric parameters. You should probably override the gerenated code (not ideal, I admit) and use a string parameter instead. This will return the data with full precision, which can then be interpreted by your application.
 
Hello,
Ah thank you. So internally all the fields are retrieved as strings (and then just converted to the requested type?)? I've tested it out and that works! But as you mention, it's not ideal.. we're regularly regenerating the Delphi files as the packages are updated (system in development), it's not very practical changing them all manually (as the packages are large)..

Is there a possibility you guys might look at a cleaner fix/solution for this? I can see it may be hard to tell from the package definition what is actually returned, considering you only seem to be able to declare the return variables as "Number" with no size or precision within the package (unless I'm missing something?).. hmm

Thanks for your help, and any changes to the wizard code to help with this situation would be greatly appreciated!

David
 
Ah thank you. So internally all the fields are retrieved as strings (and then just converted to the requested type?)?
No, the variables are declared as Integer, Double, or String, and Oracle converts the data to the declared type.
Is there a possibility you guys might look at a cleaner fix/solution for this?
I have added this to the list of enhancement requests.
 
Back
Top