首页 > 数据库 > Oracle > Oracle's quote operator
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;
...................
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/26719/viewspace-1050138/ ,如需转载,请注明出处,否则将追究法律责任。