,

q{Oracle's quote operator}

вторник, 5 октября 2010 г. Оставить комментарий

Oracle 10g introduced a new mechanism to write in quotes. In previous versions it was necessary to use double quotes. You can now use the syntax q'quote_delimiter ... quote_delimiter'.see more...


SQL> set serveroutput on
SQL>
SQL> declare
2 vs varchar2(100);
3 vcur sys_refcursor;
4
5 vSQL varchar2(2000) :=
6 q'@
7 select 'MARY' as nm from dual union all
8 select q'BBEN'S BOOKB' as nm from dual union all
9 select q'XMARK'S CATX' as nm from dual union all
10 select q'[TED'S DOG]' as nm from dual
11 @';
12 begin
13
14 open vcur for vSQL;
15
16 dbms_output.put_line(vSQL);
17 loop
18 fetch vcur into vs;
19 exit when vcur%notfound;
20 dbms_output.put_line(vs);
21 end loop;
22 close vcur;
23 end;
24 /


select 'MARY' as nm from dual union all
select q'BBEN'S BOOKB' as nm from dual union all
select q'XMARK'S CATX' as nm from dual union all
select q'[TED'S DOG]' as nm from dual

MARY
BEN'S BOOK
MARK'S CAT
TED'S DOG

PL/SQL procedure successfully completed

0 коммент. »

Оставьте Ваш комментарий