单引号转义符q’的使用

当字符串包含单引号时,可以使用转义符q’对单引号进行转义。

q’后面的字符可以是:

!

[ ]

{ }

( )

< >

前提是这些字符不会出现在后续的SQL中。

例子1:直接使用单引号转义

SQL> select ‘it”s an example’ as"Example" from dual;

Example

——————————

it’s an example

例子2:使用q’转义符转义

SQL> select q'[it’s an example]’ as"Example" from dual;

Example

——————————

it’s an example

上面两种写法都正确,但是显然后者可阅读性更强。

,自己喜欢的人,那就随便怎么样了,

单引号转义符q’的使用

相关文章:

你感兴趣的文章:

标签云: