ORA 01861 文字與格式字串不匹配

2021-09-30 09:59:38 字數 584 閱讀 8758

ora-01861:文字與格式字串不匹配

select * from a where opertime='2004-1-8 18:51:44';

或是select * from a where opertime='2004-1-8';

或是select * from a where opertime='2004-01-08';

都會報錯:

ora-01861:文字與格式字串不匹配

不知道日期格式需不需要用引號給擴起來,或是有其他的規則。

oracle中的sql 語句格式:

最好用to_date函式轉換一下就沒有問題了,例如:

to_date('2004-1-8','yyyy/mm/dd')

或者用alter session set nls_date_format='yyyy-mm-dd',然後用

select * from a where opertime='2004-1-8';

也沒有問題。

select * from a where opertime like to_date('2004-1-8%','yyyy-mm-dd hh24:mi:ss');

ORA 01861 文字與格式字串不匹配

解決方法 這樣的插入的時候就不會報這個ora 01861 insert into lduser usercode,username,comcode,password,operator,makedate,maketime,validstartdate,validenddate,pwdflagdate ...

ORA 01861 文字與格式字串不匹配

現象 oracle 查詢時間時 報錯 ora 01861 文字與格式字串不匹配 解決 資料庫中儲存的日期格式有問題。1 11月 17 修復錯誤資料 oracle將字串轉換為日期時,需要乙個格式 比如 yyyy mm dd 次格式就是待轉換的字串的格式,如果你沒有寫格式,那oracle就會採用nls ...

ORA 01861 文字與格式字串不匹配

這個錯誤一般出現在日期時間欄位上,即你插入的時間格式和資料庫現有的時間格式不一致,解決的方法是格式化你 注 yyyy mm dd hh24 mi ss是因為oracle不區分mm和mm大小寫,分鐘寫成mi否則會顯示月份。這樣的插入的時候就不會報這個ora 01861 當用pl sql develop...