Convert Integer to Decimal in Oracle

Asked

Viewed 1,444 times

1

how do I convert a whole number to decimal on oracle?

Today, the consultation coming out this way.

75

However, I want you to go out with 2 decimal places, that way.

75.00

Below is the syntax of the column.

select nvl(sum(ve.vl_vencimento),0) Valor_Total_da_Ordem from ordem_compra

2 answers

0


You can always use the function TO_CHAR:

SELECT  TO_CHAR(NVL(SUM(ve.vl_vencimento), 0), '999999D99') Valor_Total_da_Ordem 
FROM    ordem_compra
  • Thanks @Joãomartins, it worked.

  • You are welcome! Take advantage and give an UP on the answer :)

0

If your application already has treatment based on oracle types, it is possible to type cast the desired field using the function CAST

select Cast(nvl(sum(ve.vl_vencimento),0) as DECIMAL(10,2)) Valor_Total_da_Ordem from ordem_compra

Browser other questions tagged

You are not signed in. Login or sign up in order to post.