请问一下,oracle数据库中的查询语句中的记录中有[]号,查询不出来怎么办?例如,select * from A1 where strname='a[1]';出来没有记录,其实是有的。

解决方案 »

  1.   

    select * from A1 where strname='a\[1\]' ESCAPE '\';
      

  2.   

    select * from A1 where strname like '%a[1]%'
    看看,也许strname里包含空格,所以不能查询出来
      

  3.   

    datatype of strname is char not varchar in your db?should use 
    select * from A1 where trim(strname)='a[1]';
      

  4.   

    樓主的查詢條件有問題SQL> create table t1 (strname varchar(10));Table createdSQL> insert into t1 values ('a[1]');1 row insertedSQL> select * from t1;STRNAME
    ----------
    a[1]SQL> select * from t1 where strname='a[1]';STRNAME
    ----------
    a[1]
      

  5.   

    select * from A1 where strname='a[1]';
    a[1]中间某个地方有空格?
    select * from A1 where replace(strname,' ','')='a[1]';