Hi,

> I'm porting many financials views form IBM DB2 to H2 where built-in DEC
> () function is used very often.
>
> DEC( anyNumericType , len, dec ) function convert any numeric data
> type to a DECIMAL data type of a given length and decimal positions.
>
> Example  dec( doubleX , 8,4) =  xxx.xxxx
>
> I wonder if there are something similar in H2 or some way to emulate
> this function without add any .jar or custom class addition.

The standard method is to use  cast(x as decimal(8, 4)). This works on
most databases:

drop table test;
create table test(x int);
insert into test values(1);
select cast(x as decimal(8, 4)) from test;

I tested PostgreSQL, MySQL, HSQLDB, Derby and H2.

Regards,
Thomas

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/h2-database?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to