jbu11
jbu11

Reputation: 15

How do you convert a varchar2 into a number with two decimal places?

Sorry, I am new at Oracle and am having some troubles selecting some numbers that are in a table that are varchar2.

I need them to be numbers with 2 decimal places.

for example:

00008600  
00202033  
00094123

need to be

86.00  
2020.33  
941.23  

How would I be able to do this?

Upvotes: 1

Views: 1558

Answers (1)

Taryn
Taryn

Reputation: 247690

You can use something like this:

select to_char(to_number(yourcol)/100.0, '9999999d99') yourColFormatted
from yourTable

See SQL Fiddle with Demo

Upvotes: 1

Related Questions