oracle 전의 문자

4779 단어 Oaclesql
oracle 전의 문자 (전송) (2007 - 12 - 27 14: 42: 31) 전송 태그: it


         '%',   oracle     ,     : 
SQL> select * from test;

TEST
--------------------
sdd_kk
d'd
dfsfsa
dffa%asfs
12345
1%2345
1%54321
2%54321
%%54321
A&B

   9 。


                    %,_,&,                ,               。


SQL> select * from test where test like 'sdd _%' escape ' ';

TEST
--------------------
sdd_kk

             ' ';

SQL> select * from test where test like 'sdd\_%' escape '\';

TEST
--------------------
sdd_kk

     '\';


SQL> select * from test where test like 'sdd=_%' escape '=';

TEST
--------------------
sdd_kk

             '=';

SQL> select * from test where test like 'sdd/_%' escape '/';

TEST
--------------------
sdd_kk

               '/';

SQL> select * from test where test like 'sddd_%' escape 'd';

    

             d,        ;

SQL> select * from test where test like '%\_%' escape '\';

TEST
--------------------
sdd_kk

              '_'   。

          :          '%'     :

SQL> select * from test where test like '%\%%' escape '\';

TEST
--------------------
dffa%asfs
1%2345
1%54321
2%54321
%%54321

          '&'          :

SQL> select * from test where test like '%\&%' escape'\';
select * from test where test like '%\&%' escape'\'
                                   *
  1      :
ORA-01424:             

                     :

SQL> select ascii('&') from dual;

ASCII('&')
----------
        38

SQL> select * from test where test like '%'||chr(38)||'%';

TEST
--------------------
A&B

           '''   :

SQL> select * from test where test like '%''%';

TEST
--------------------
d'd

          

SQL> insert into test values('test&test');
   test   : test
      1: insert into test values('test&test')
      1: insert into test values('testtest')          -    ,      。

    1  。

SQL> show define
define "&" (hex 26)
SQL> set define off
SQL> show define
define OFF
SQL> insert into test values('test&test');

    1  。

SQL> show escape
escape OFF
SQL> set escape on
SQL> show escape
escape "\" (hex 5c)
SQL> insert into test values('test\&test');

    1  。

SQL> select * from test;

TEST
--------------------
sdd_kk
d'd
dfsfsa
dffa%asfs
12345
1%2345
1%54321
2%54321
%%54321
A&B
testtest

TEST
--------------------
test&test
test&test

   13 。

SQL> commit;

    。

SQL> select * from test;

TEST
--------------------
sdd_kk
d'd
dfsfsa
dffa%asfs
12345
1%2345
1%54321
2%54321
%%54321
A&B
testtest

TEST
--------------------
test&test
test&test

   13 。

SQL> insert into test values('test\%test');

    1  。

SQL> insert into test values('test\_test');

    1  。

SQL> insert into test values('test\'test);
insert into test values('test'test)
                              *
  1      :
ORA-00917:     


SQL> insert into test values('test''test');

    1  。

SQL> select * from test;

TEST
--------------------
sdd_kk
d'd
dfsfsa
dffa%asfs
12345
1%2345
1%54321
2%54321
%%54321
A&B
testtest

TEST
--------------------
test&test
test&test
test%test
test_test
test'test

   16 。


좋은 웹페이지 즐겨찾기