Home > Database > Mysql Tutorial > body text

Oracle中quote的使用

WBOY
Release: 2016-06-07 16:42:36
Original
1267 people have browsed it

在SQL或者PLSQL中如果要表达一个带有特殊字符的字符串时,通常要用

在SQL或者PLSQL中如果要表达一个带有特殊字符的字符串时,,通常要用''包装起来。但如果字符串本身包含‘或者“这样的字符,那么实现起来有点繁琐。

比如:My Name is "Wang Xiu Li"

用sql实现

SQL> select 'My Name is "Wang Xiu Li"' names from dual;

NAMES
------------------------
My Name is "Wang Xiu Li"

Oracle提供了一个Q-quote的表达式,用来简化SQL或PLSQL中字符串的表示,quote实现

SQL> select q'[My Name is "Wang Xiu Li"]' names from dual;

NAMES
------------------------
My Name is "Wang Xiu Li"

注意语法:必须将要表示的字符串用一对特殊字符括起来,这对字符必须一致。

本文永久更新链接地址:

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!