Home > Database > Mysql Tutorial > body text

Oracle的SQL语句中如何处理‘’符号

WBOY
Release: 2016-06-07 16:51:08
Original
1321 people have browsed it

lsquo;rsquo;符号在SQL中有特殊含义,所以在SQL中想要写入,需要特殊处理。如下SQL语句就不能正确运行:SQLgt; select #39;

‘&’符号在SQL中有特殊含义,所以在SQL中想要写入&,需要特殊处理。

如下SQL语句就不能正确运行:

SQL> select 'a&b' from dual;

处理方法:

用Oracle的字符串处理函数chr处理。chr(38)表示 &符号

如:select chr(38) from dual;

结果:&

SQL> select 'a'||chr(38)||'b' from dual;

结果:a&b

其他不能处理的特殊符合,,也用类似的方式处理。如果不知道该特殊符号的值,可以调用ascii函数处理

如:select ascii('&') from dual;

结果:38

linux

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!