What type in Oracle (10 Express Edition) would be the "same" as a Java int?
+9
A:
Java's int has a range of -2,147,483,648 to 2,147,483,647 - so Number(10,0) is as close as you're going to get...
Martin Milan
2010-06-14 21:05:45
And, if appropriate, you can add a check constraint to the column, `check (column_name between -2147483648 and 2147483647)` to make sure the data stored does not fall outside of the range that the application can handle.
Shannon Severance
2010-06-14 21:31:20
shouldn't this be NUMBER(9,0)? With NUMBER(10,0) you could have a value (e.g. 9,999,999,999) that would exceed the range of a Java int.
Aaron F.
2010-08-25 16:51:39
No - then you wouldn't be covering the whole of the int type's range.
Martin Milan
2010-09-12 09:47:10
Shannon Severance's point above will handle it.
Martin Milan
2010-09-12 09:47:26
A:
I suggest using BINARY_INTEGER. BINARY_INTEGER is declared in SYS.STANDARD with a range of -2147483647 to 2147483647.
Share and enjoy.
Bob Jarvis
2010-06-15 11:27:31
Except, of course, that it can't be used in a table. Not thinking clearly - my bad.
Bob Jarvis
2010-06-15 11:29:06