當oracle出現 格式與字串格式不匹配解決辦法
select v.spid spid,v.appid appid,v.version version,v.newversion newversion,v.status status,v.createtime createtime from adc_spversionchangeapply v inner join adc_application a on a.id=v.appid
where a.create_by = 'a' and v.appid = '12000000005' and (v.createtime >= '1987-05-06') and (v.createtime <= '2009-04-29')
加入v.createtime在資料庫中試date型別 那麼會跑出異常
ORA-01861: 文字與格式字串不匹配
實際上是因為 '1987-05-06'是字串型別導致的date型別與字串型別 件跨型別比較 所以是有問題的
將'1987-05-06' 寫成to_date('1987-09-18','yyyy-mm-dd')
就行了
程式碼如下
select v.spid spid,v.appid appid,v.version version,v.newversion newversion,v.status status,v.createtime createtime from adc_spversionchangeapply v inner join adc_application a on a.id=v.appid
where a.create_by = 'a' and v.appid = '12000000005' and (v.createtime >= to_date('1987-05-12','yyyy-mm-dd')) and (v.createtime <= to_date( '2009-04-29','yyyy-mm-dd')
--------------------- 本文來自 liaomin416100569 的CSDN 部落格 ,全文地址請點選:https://blog.csdn.net/liaomin416100569/article/details/5393019?utm_source=copy