cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

decimal precision for query (jdbc limitation ?)

olivier_thiry
Participant
0 Likes
520

Hello,

General question about query action block... Can we influence number of decimals returned ?

For example, if we run this query (Oracle, but same with Hana for example):

select (8/3) as third from dual

It will give me : 2.666666666667

So 12 decimals precision, where if I run in SQL dev, I have much much more precision...

Is this a JDBC limitation/setting ?

For some of our process, 12 digits precision is not enough...

Thanks

Accepted Solutions (1)

Accepted Solutions (1)

salvatore_castro
Product and Topic Expert
Product and Topic Expert
0 Likes

Did you try to use the "CAST()" function to tell the database it's a NUMERIC and also specify the precision in the SQL request?  Seems the above it a bit arbitrary on the datatype of the value being returned as it's not selecting from a column.

Sam

olivier_thiry
Participant
0 Likes

Thanks for your reply Sam, we tried, but this didn't really helped...

We were using such construction in some queries to do computation on time fields, using fractions to add hours, minutes or seconds. This is fine in Oracle, but Hana is using integer value...

So in fact, we need to change our queries to now use also integer and also adapt our java code(WDP) processing the result...

For example :

In Oracle

select '0001-01-01 00:00:00' + 0.5625 from dual ;

Result: 0001-01-01 13:30:00'

In HANA we have the same action as:

select add_seconds('0001-01-01 00:00:00', 48600) from dummy;

Result: 0001-01-01 13:30:00'

Answers (0)

Ask a Question