ITPub博客

首页 > 数据库 > Oracle > Oracle's quote operator

Oracle's quote operator

原创 Oracle 作者:ywolf 时间:2011-05-20 15:59:21 0 删除 编辑

q'! text-to-be-quoted !'

! is a signle character, called the quote delimiter. with the quote operator, apostrophes don't have to be dboule:

e.g.

select q'#Oracle's quote operator#' quote_test from dual;
QUOTE_TEST
--------------------------
Oracle's quote operator

it's very helpful and convenience to use the quote, particularly when you want to update or insert a very long and big sql.

e.g:

DECLARE
l_sql VARCHAR2(32767);
BEGIN
l_sql := q'!
select ********** very very long sql here
!';

UPDATE table_name
SET attribute = l_sql
WHERE condition;

COMMIT;

...................

[@more@]

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/26719/viewspace-1050138/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
  • 博文量
    5
  • 访问量
    108755