Oracle之q操作符

Oracle本身默认的是单引号,但是在大家写存储过程或者写SQL语句时,有时候需要拼SQL或者是SQL的值里需要传入含单引号的值,此时就需要使用两个单引号''''来进行转义,其实oracle本身提供了这种转换默认单引号为其他标识的方法那就是——"q"
q [Oracle's quote operator]

q'c text-to-be-quoted c'
c is a single character (called the quote delimiter).

With the «quote operator» apostrophes don't have to be doubled:

SQL> select q'#Oracle's quote operator#' from dual;

Q'#ORACLE'SQUOTEOPERATO
-----------------------
Oracle's quote operator

begin
  execute immediate q'#select * from abc#';
end;
posted @ 2015-04-27 15:43  Pekkle  阅读(675)  评论(0编辑  收藏  举报