Skip to Main Content

Java Database Connectivity (JDBC)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

BigDecimal and Oracle | Precision Issue when using Hibernate

843859Jun 30 2010 — edited Nov 20 2014
I am facing an issue while persisting a BigDecimal value in orcale 9i db column of type Number(23,8) via hibernate.

I have created the following mapping and when trying to persist *434343434345.29* value being persisted in the db
*434343434345.28998400*

*<property name="myField" type="big_decimal">*
*<column name="myColumn" precision="23" scale="8"/>*
*</property>*

I also tried the following mappings and results were same

*<property name="myField" type="big_decimal">*
*<column name="myColumn" sql-type="NUMERIC(23,8)"/>*
*</property>*


One more observation was when I run the query
select from MyTable;*
it shows me value as *434343434345.28998400*

while when I run the following query
select to_char(myColumn), to_number(myColumn) from MyTable;
it shows me values as *434343434345.29*

Could someone kindly suggest the resolution. A quick help is required.

Thanks,
Dheeraj
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 28 2010
Added on Jun 30 2010
2 comments
812 views