Print Thread
Returning 64 bit integers from Oracle Package functions..
#8976 01/29/07 06:18 PM
Joined: Jan 2007
Posts: 2
C
Member
OP Offline
Member
C
Joined: Jan 2007
Posts: 2
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

Re: Returning 64 bit integers from Oracle Package functions..
#8977 01/29/07 11:16 PM
Joined: Aug 1999
Posts: 22,219
Member
Offline
Member
Joined: Aug 1999
Posts: 22,219
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.


Marco Kalter
Allround Automations
Re: Returning 64 bit integers from Oracle Package functions..
#8978 01/30/07 05:23 AM
Joined: Jan 2007
Posts: 2
C
Member
OP Offline
Member
C
Joined: Jan 2007
Posts: 2
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

Re: Returning 64 bit integers from Oracle Package functions..
#8979 01/30/07 11:41 PM
Joined: Aug 1999
Posts: 22,219
Member
Offline
Member
Joined: Aug 1999
Posts: 22,219
[quote]Ah thank you. So internally all the fields are retrieved as strings (and then just converted to the requested type?)?[/quote]No, the variables are declared as Integer, Double, or String, and Oracle converts the data to the declared type.
[quote]Is there a possibility you guys might look at a cleaner fix/solution for this?[/quote]I have added this to the list of enhancement requests.


Marco Kalter
Allround Automations

Moderated by  support 

Link Copied to Clipboard
Powered by UBB.threads™ PHP Forum Software 7.7.4
(Release build 20200307)
Responsive Width:

PHP: 7.1.33 Page Time: 0.034s Queries: 13 (0.007s) Memory: 2.5093 MB (Peak: 3.0418 MB) Data Comp: Off Server Time: 2024-05-15 09:26:28 UTC
Valid HTML 5 and Valid CSS