HomeMogDBMogDB StackUqbar
v5.0

Documentation:v5.0

Supported Versions:

Other Versions:

Support Q Quote Escape Character

Availability

This feature is available since MogDB 5.0.0.

Introduction

This feature is compatible with Oracle's use of q' for global single-quote escaping of individual strings, e.g., SELECT q'{I'm fine}';

Benefits

Enhance MogDB compatibility with Oracle to reduce application migration costs.

Constraints

  • Due to JDBC local character checking, JDBC execution of this command is currently not supported for the time being.

Syntax Description

The syntax is one letter q (case insensitive), one single quote, one delimiter, the original string text, one delimiter, and one single quote.

img

The q' escape character is usually followed by ! [] {} () <> and other escape symbols are used as delimiters, or you can use \ , or you can use letters, numbers, =, +, -, *, &, $, %, #, etc., and you can't use spaces, tab keys.

The delimiter cannot be a non-English, non-numeric, non-special character. If the intermediate string contains a delimiter, you need to make sure that the delimiter is not followed by single quotes.

The range of delimiters includes special characters, English characters, and numbers.

Special characters: {},',:,|,[],,|,<>,? ,=,+,-,_,(),*,&,^,%,$,#,@,! ,~,`,. ,/, including commas, double quotes", single quotes'

For example, SELECT q'{I'm }' fine}' uses { as a delimiter, but the intervening string contains } and is followed by single quotes, which are not supported by this syntax.

Example

SELECT q '{I'm fine}';
 ?column? 
----------
 I 'm fine
( 1 row)
 
SELECT q ''I'm fine'';
 ?column? 
----------
 I 'm fine
( 1 row)
 
SELECT q '[I'm fine]';
 ?column? 
----------
 I 'm fine
( 1 row)
 
SELECT q '\I'm fine\';
 ?column? 
----------
 I 'm fine
( 1 row)
 
SELECT q '<I'm fine>';
 ?column? 
----------
 I 'm fine
( 1 row)
 
SELECT q '?I'm fine?';
 ?column? 
----------
 I 'm fine
( 1 row)
 
SELECT q 'aI'm finea';
 ?column? 
----------
 I 'm fine
( 1 row)
 
SELECT q '2I'm fine2';
 ?column? 
----------
 I 'm fine
( 1 row)
 
SELECT q '=I'm fine=';
 ?column? 
----------
 I 'm fine
( 1 row)
 
SELECT q '-I'm fine-';
 ?column? 
----------
 I 'm fine
( 1 row)
 
SELECT q '(I'm fine)';
 ?column? 
----------
 I 'm fine
( 1 row)
 
SELECT q '*I'm fine*';
 ?column? 
----------
 I 'm fine
( 1 row)
 
SELECT q '&I'm fine&';
 ?column? 
----------
 I 'm fine
( 1 row)
 
SELECT q '^I'm fine^';
 ?column? 
----------
 I 'm fine
( 1 row)
 
SELECT q '%I'm fine%';
 ?column? 
----------
 I 'm fine
( 1 row)
 
SELECT q '$I'm fine$';
 ?column? 
----------
 I 'm fine
( 1 row)
 
SELECT q '#I'm fine#';
 ?column? 
----------
 I 'm fine
( 1 row)
 
SELECT q '@I'm fine@';
 ?column? 
----------
 I 'm fine
( 1 row)
 
SELECT q '!I'm fine!';
 ?column? 
----------
 I 'm fine
( 1 row)
 
SELECT q '~I'm fine~';
 ?column? 
----------
 I 'm fine
( 1 row)
 
SELECT q '`I'm fine`';
 ?column? 
----------
 I 'm fine
( 1 row)
 
SELECT q '{'s is good}';
  ?column?  
------------
  's is good
( 1 row)
 
SELECT q '''s is good'';
  ?column?  
------------
  's is good
( 1 row)
 
SELECT q '['s is good]';
  ?column?  
------------
  's is good
( 1 row)
 
SELECT q '\'s is good\';
  ?column?  
------------
  's is good
( 1 row)
 
SELECT q '<'s is good>';
  ?column?  
------------
  's is good
( 1 row)
 
SELECT q '?'s is good?';
  ?column?  
------------
  's is good
( 1 row)
 
SELECT q 'a's is gooda';
  ?column?  
------------
  's is good
( 1 row)
 
SELECT q '2's is good2';
  ?column?  
------------
  's is good
( 1 row)
 
SELECT q '='s is good=';
  ?column?  
------------
  's is good
( 1 row)
 
SELECT q '-'s is good-';
  ?column?  
------------
  's is good
( 1 row)
 
SELECT q '('s is good)';
  ?column?  
------------
  's is good
( 1 row)
 
SELECT q '*'s is good*';
  ?column?  
------------
  's is good
( 1 row)
 
SELECT q '&'s is good&';
  ?column?  
------------
  's is good
( 1 row)
 
SELECT q '^'s is good^';
  ?column?  
------------
  's is good
( 1 row)
 
SELECT q '%'s is good%';
  ?column?  
------------
  's is good
( 1 row)
 
SELECT q '$'s is good$';
  ?column?  
------------
  's is good
( 1 row)
 
SELECT q '#'s is good#';
  ?column?  
------------
  's is good
( 1 row)
 
SELECT q '@'s is good@';
  ?column?  
------------
  's is good
( 1 row)
 
SELECT q '!'s is good!';
  ?column?  
------------
  's is good
( 1 row)
 
SELECT q '~'s is good~';
  ?column?  
------------
  's is good
( 1 row)
 
SELECT q '`'s is good`';
  ?column?  
------------
  's is good
( 1 row)
Copyright © 2011-2024 www.enmotech.com All rights reserved.