This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Oracle jdbc driver getColumnType return Number

 
Sharon whipple
Ranch Hand
Posts: 294
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all
I have FLOAT column in my oracle db,
When calling ResultSetMetaData.getColumnType() I get java.sql.Types.NUMERIC; instead of java.sql.Types.FLOAT

What is the correct way to get the column type?


 
Stephan Mueller
Ranch Hand
Posts: 50
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As far as I know, there is no FLOAT datatype in Oracle. They are using NUMBER (NUMERIC) which is the SQL-92 standard for numbers (decimals and floats, etc.)
You have to check the NUMERIC attributes to get an idea whether this should represent an Integer or not. For example NUMBER(10,7) is for a float/double.

Please refer to http://ss64.com/ora/syntax-datatypes.html for Oracle's data-types (version 8-11g)
and http://download.oracle.com/javase/1.3/docs/guide/jdbc/getstart/mapping.html for how to map datatypes.
Section 8.3.11 DECIMAL and NUMERIC:
The corresponding SQL types DECIMAL and NUMERIC are defined in SQL-92 and are very widely implemented. These SQL types take precision and scale parameters. The precision is the total number of decimal digits supported, and the scale is the number of decimal digits after the decimal point. For most DBMSs, the scale is less than or equal to the precision. So for example, the value "12.345" has a precision of 5 and a scale of 3, and the value ".11" has a precision of 2 and a scale of 2. JDBC requires that all DECIMAL and NUMERIC types support both a precision and a scale of at least 15.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic