NUMBER(38)
means a whole number that can have up to 38 digits of precision. In other words 38 digits. Int64 is a 64-bit whole number. The maximum value that a 64-bit value can hold is 9,223,372,036,854,775,807 which has only 19 digits of precision. You cannot store a NUMBER(38)
into an Int64
. The equivalent of an Int64
in Oracle is BIGINT.
While it might work on some tables, ultimately MAX(<field>)
is returning a value outside the range of Int64
and hence the conversion is failing. You can run your query using SQL Navigator to confirm that the table is getting a value larger than can be stored in Int64
to confirm this.
Once you've confirmed the issue you'll need to decide what data type will work for the data stored in the table.