用escape指定转义如下: SQL> select * from ww where test like 'wwd\_%' escape '\';TEST -------------------- wwd_kk转义字符为'\';
额……比方说……像下面这个: create or replace function fun_get_bookinfo(key_words varchar2(10)) returns table(……) return table (select * from v_book_info where bookname like '/_%' key_words '/');like后面与字符串匹配,但是要用到传进来的参数直接引号括起来不就不能传参了么,是应该上面那样写么……
要特殊符号转义,就参考3L select * from v_book_info where bookname like '/_%' || key_words || '/' 熟悉一下sql与变量结合
vvv varchar2(40) :='/_% key_words'; bbb varchar2(400) begin select col into bbb from table where col like vvv escape '/'; end;
vvv varchar2(40) :='/_% key_words'; bbb varchar2(400) begin select col into bbb from table where col like vvv escape '/'; end;
SQL> select * from ww where test like 'wwd\_%' escape '\';TEST
--------------------
wwd_kk转义字符为'\';
create or replace function fun_get_bookinfo(key_words varchar2(10))
returns table(……)
return table
(select * from v_book_info where bookname like '/_%' key_words '/');like后面与字符串匹配,但是要用到传进来的参数直接引号括起来不就不能传参了么,是应该上面那样写么……
select * from v_book_info where bookname like '/_%' || key_words || '/'
熟悉一下sql与变量结合
bbb varchar2(400)
begin
select col into bbb from table where col like vvv escape '/';
end;
bbb varchar2(400)
begin
select col into bbb from table where col like vvv escape '/';
end;