SQL SQL如何将十进制转换为字符串

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2488860/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-01 05:44:37  来源:igfitidea点击:

SQL How to convert a decimal to a string

sqloracle

提问by theringostarrs

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

在 SELECT 语句中,我想将值转换为字符串,即。选择 TO_STRING(值)。

How can I do this in Oracle SQL?

如何在 Oracle SQL 中执行此操作?

回答by Phil Ross

You can use either the TO_CHARor the CASTfunction:

您可以使用TO_CHARCAST函数:

SELECT TO_CHAR(123.45) FROM DUAL

SELECT CAST(123.45 AS VARCHAR2(10)) FROM DUAL

回答by Sunny

SELECT CAST(column_name as data_type) from ...  

might work

可能有用

HTH

HTH