在sql中用单引号输出 [英] output with single quote in sql

查看:183
本文介绍了在sql中用单引号输出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

表值

名字
金额
邮政编码
姓氏
帐号

Firstname
Amount
Postalcode
Lastname
Accountnumber

名字"
金额"
邮政编码"
'姓氏'
帐号"

'Firstname'
'Amount'
'Postalcode'
'Lastname'
'Accountnumber'

推荐答案

mysql中,您可以使用函数

In mysql you can use the function concat():

SELECT CONCAT("'", CNAME, "'") FROM yourTable

oracle中,您可以使用与上述相同的功能 concat() concatenation operator :

In oracle you can use the same function as above concat() or the concatenation operator:

SELECT '''' || CNAME || '''' FROM yourTable;
SELECT CONCAT('''', CNAME, '''') FROM yourTable;

这篇关于在sql中用单引号输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆