oracle中escape的使用例子

    技术2022-05-11  80

    定义:escape关键字经常用于使某些特殊字符,如通配符:'%','_'转义为它们原

    来的字符的意义,被定义的转义字符通常使用'/',但是也可以使用其他的符号。

    SQL> select * from test;

            ID NAME---------- --------------------         1 a%b         1 a_c%         3 a/%b         4 a/%b

     

     SQL> select * from test  2  where name like 'a/%%'  3  escape '/';

            ID NAME---------- --------------------         1 a%b

    注意:如果是 '/' 作为检索字符, 必须 用 '/' 作为转义符, 正斜扛也一样.select * from wan_test where psid like '%//%' escape '/'

    SQL> select * from test  2  where name like 'a///%b'  3  escape '/';

            ID NAME---------- --------------------         4 a/%b


    最新回复(0)