zoukankan      html  css  js  c++  java
  • 【Oracle】oracle10g以后利用q-quote特性简化包含单引号后双引号的字符串写法

    The Q-quote delimiter can be any single- or multibyte character except space, tab, and return. If the opening quote delimiter is a [, {, <, or ( character, then the closing quote delimiter must be the corresponding ], }, >, or )character. In all other cases, the opening and closing delimiter must be the identical character.

    oracle10g以后开始引入的一个新特性:q-quote

    使用Q或q开头(如果是national character literals,则是将N或n放在Q或q之前),字符串的前后使用界定符“ ' ” 单引号括起来。

    注:q-quote的界定符可以是除了TAB、空格、回车以外的任何单字节或双字节字符;一般情况下,可以统一使用{} 或[]或 <>或 () 作为界定符。

    使用方法如下:

    select q'[select 'hello' as str from dual]' as q_str from dual;

    查询结果如下:

    或者带双引号的,如下:

    select q'[select 'I say "hello"' as str from dual]' as q_str from dual;

    这样就比每次需要写单引号的时候,用多个单引号括起来要更方便一些。

    --------------------------------------------------------------------------

  • 相关阅读:
    Linux中的计算器(bc)
    在Linux中显示日历(cal)
    在Linux中显示日期(date)
    Linux中的注销当前用户
    Linux中的提示符
    在Linux中启动X Window
    硬盘知识
    划分Linux分区
    Linux中的关机
    hdu4424 Conquer a New Region 并查集/类似最小生成树
  • 原文地址:https://www.cnblogs.com/uzipi/p/4203566.html
Copyright © 2011-2022 走看看