简体   繁体   中英

SQL How to convert a decimal to a string

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

How can I do this in Oracle SQL?

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
SELECT CAST(column_name as data_type) from ...  

might work

HTH

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM