错误信息如下:
SQL> select StartDate, MailTo, MailFrom, Subject, EmailID, URL1, Priority, 
  2  Status, RealEmail, MailCC, FolderID from Emails 
  3  where UserID = 1 and ((MailTo LIKE '%[email protected]%') 
  4  OR (MailCC LIKE '%[email protected]%')) 
  5  and ((MailFrom LIKE '%[email protected]%') 
  6  OR (RealEmail LIKE '%[email protected]%')) 
  7  and Subject LIKE '%fs%' 
  8  and Body LIKE '%sy%'
  9  and StartDate 
 10  Between '2002-12-08 16:00:00'
 11  and '2002-12-10 15:59:59'
 12  AND FolderID = 0 
 13  AND Status = 1 
 14  AND URL1 IS NOT NULL 
 15  ORDER BY StartDate DESC
 16  ;
and Body LIKE '%sy%'
    *
ERROR 位于第 8 行:
ORA-00932: 数据类型不一致

解决方案 »

  1.   

    把对colb字段的MailTo  LIKE  '%[email protected]%'都改成
    dbms_lob.instr(MailTo,'[email protected]',1,1)>0
      

  2.   

    StartDate 
     10  Between '2002-12-08 16:00:00'
     11  and '2002-12-10 15:59:59'
     
    上面startdate是日期型吗?
    把它to_date('2002-12-08 16:00:00','yyyy-mm-dd hh24:mi:ss')
    to_date('2002-12-10 15:59:59','yyyy-mm-dd hh24:mi:ss')还要加括号来(StartDate Between to_date('2002-12-08 16:00:00','yyyy-mm-dd hh24:mi:ss') and to_date('2002-12-10 15:59:59','yyyy-mm-dd hh24:mi:ss'))
      

  3.   

    谢谢 bzszp,问题解决了。
    这个问题我想了很久,都没解决,没想到你一会就解决了,真是太牛了。
    我还想问一个问题,我想把原来表中的CLOB类型改成VARCHAR2类型,为什么不可以?