I need a way to convert hex values to numbers so that I can sum them together (I need to end up with a single value) in both oracle and SQL server. I’m having a hard time getting the same results on both servers. These are the hex values:
SQL SERVER ORACLE
____________________________________________________________________
0x6512BD43D9CAA6E02C990B0A82652DCA 6512BD43D9CAA6E02C990B0A82652DCA
0xC20AD4D76FE97759AA27A0C99BFF6710 C20AD4D76FE97759AA27A0C99BFF6710
0xC51CE410C124A10E0DB5E4B97FC2AF39 C51CE410C124A10E0DB5E4B97FC2AF39
0x1FF1DE774005F8DA13F42943881C655F 1FF1DE774005F8DA13F42943881C655F
0x1C383CD30B7C298AB50293ADFECB7B18 1C383CD30B7C298AB50293ADFECB7B18
0xC74D97B01EAE257E44AA9D5BADE97BAF C74D97B01EAE257E44AA9D5BADE97BAF
0x67C6A1E7CE56D3D6FA748AB6D9AF3FD7 67C6A1E7CE56D3D6FA748AB6D9AF3FD7
0x6F4922F45568161A8CDF4AD2299F6D23 6F4922F45568161A8CDF4AD2299F6D23
I’m pretty much open to any solution and any help is appreciated. Thanks.
These hex values are too large to be stored as numbers, period. The examples given are 32 hex digits, which would need a data type of 124 bits (unsigned). You will overflow if you attempt to use native integers. Summing them will produce even larger values.
One way or another, you will need to find a way to deal with arbitraryily long hex numbers. Either find or write a math library to do this. In Oracle you could probably do this with Java or .NET stored procedures. Similarly, SQL Server would probably have .NET routines which can be used, which would give consistent code. Its unlikely that PL/SQL or T-SQL solutions will perform very well.