Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SQL How to convert a decimal to a string

Tags:

sql

oracle

In a SELECT statement I want to convert values to strings ie. SELECT TO_STRING(value).

How can I do this in Oracle SQL?

like image 737
theringostarrs Avatar asked Mar 21 '10 21:03

theringostarrs


2 Answers

You can use either the TO_CHAR or the CAST function:

SELECT TO_CHAR(123.45) FROM DUAL

SELECT CAST(123.45 AS VARCHAR2(10)) FROM DUAL
like image 170
Phil Ross Avatar answered Sep 22 '22 02:09

Phil Ross


SELECT CAST(column_name as data_type) from ...  

might work

HTH

like image 42
Sunny Avatar answered Sep 18 '22 02:09

Sunny