• 【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;

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

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

  • 相关阅读:
    今天愣了半天硬是没想到用map,在此还原以下代码
    blob文件的存储和读取
    C#操作SQLite 报错 (Attempt to write a read-only database)
    Response.Flush()
    搜索
    直接给对方邮箱写邮件
    js
    会员模块(会员注册、会员登录、忘记密码、会员中心)
    标签大全
    网站在线留言
  • 原文地址:https://www.cnblogs.com/uzipi/p/4203566.html
Copyright © 2020-2023  润新知