Home » Developer & Programmer » JDeveloper, Java & XML » Decimal(Float) missing when saved to Oracle
Decimal(Float) missing when saved to Oracle [message #92213] Wed, 21 April 2004 06:54 Go to next message
Danne
Messages: 2
Registered: April 2004
Junior Member
When I try to save or update an Oracle NUMBER field with a java Float then all decimal values is cut off? If a number is 12.1 or 12.9 doesnt matter, 12 is saved.
In other statements where a String is saved/updated to an NUMBER- field in db the correct value is saved, with decimals. When I do an "insert into test values(12.5)" in sql+ or TOAD it also works fine so it seems that decimalvalues are cut off when value is bind to statement or when the value is inserted by the class.

How to solve this??

I use PreparedStatement and executeUpdate().

Configuration
--------------------------
Database:
Oracle 9.0.1.1.1
NLS_TERRITORY: AMERICA
NLS_LANGUAGE: AMERICA
NLS_NUMERIC_CHARACTERS: .,
NLS_CHARACTERSET: WE8MSWIN1252

JDBC:
j2sdk1.4.1_07
classes12.jar

WEBSERVER:
Apache 2.0.48 + TOMCAT 4.1.29
Re: Decimal(Float) missing when saved to Oracle [message #92222 is a reply to message #92213] Fri, 23 April 2004 23:34 Go to previous messageGo to next message
lalitha
Messages: 39
Registered: June 2002
Member
Hi
Use setFloat() instead of SetInt().
laltiha
Re: Decimal(Float) missing when saved to Oracle [message #92223 is a reply to message #92213] Sat, 24 April 2004 00:07 Go to previous messageGo to next message
lalitha
Messages: 39
Registered: June 2002
Member
Hi
Use SetFloat() instead of setInt() in java
Lalitha
Re: Decimal(Float) missing when saved to Oracle [message #92224 is a reply to message #92223] Sat, 24 April 2004 11:19 Go to previous message
Danne
Messages: 2
Registered: April 2004
Junior Member
I was using setFloat(), solved the problem with setBigDecimal().
Previous Topic: publishing xml from oracle
Next Topic: publish java methods
Goto Forum:
  


Current Time: Fri Mar 29 02:12:05 CDT 2024