在SQLPlus通过它解析之前或之时,替换SQL中的特殊字符,如@

时间:2014-11-07 20:20:23

标签: sql oracle sqlplus

在SQLPlus通过它解析之前或之时,是否可以替换像@这样的字符串中的特殊字符。或者可能像本例中那样禁用@ start命令。

   set define off;
DECLARE
   test CLOB
         := q'[

 @font-face
    {font-family:Wingdings;
    panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
    {font-family:"Cambria Math";
    panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
    {font-family:Calibri;
    panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
    {font-family:Tahoma;
    panose-1:2 11 6 4 3 5 4 4 2 4;}
 /* Style Definitions */ ]' ;


BEGIN

INSERT INTO SOME_TABLE
VALUES(test)


END;
/

1 个答案:

答案 0 :(得分:0)

改为使用ASCII值,

SQL> select ascii('@') from dual;
64

现在,将@替换为chr(64)

例如,

'string one' ||chr(64)||'string two'