среда, 14 сентября 2011 г.

Alternative quoting mechanism

    Oracle Database 10g introduced an alternative quoting syntax for both SQL and PL/SQL - the so-called alternative quoting mechanism (sometimes know as the user-defined quoting mechanism, or the q-quote syntax). It aims to increase usability when the value itself contains single quote characters. Here is an example in PL/SQL:

v1 varchar2(80) := q'{You can't do that}';
v2 varchar2(80) := q'[You can't do that]';

-- Sample of where
...where Last_Name = q'{O'Brien}'

    The opening q' and the closing ' are non-negotiable; The user chooses the inner parentheses, in this example { and }.

Also characters can be any of the following as long as they do not already appear in the string:
  • !
  • [ ]
  • { }
  • ( )
  • < >

Комментариев нет:

Отправить комментарий