ORA-01841(完整)年份必须介于-4713和+999之间,并且不能为0



我使用这个查询来确定哪个工作在哪个班次完成。

SELECT srvb.kod AS code,
CASE
WHEN srvb.rectarih1 || ' ' || srvb.rectime1 >= srvb.rectarih1 || ' ' || '07:30' 
AND srvb.rectarih1 || ' ' || srvb.rectime1 <  srvb.rectarih1 || ' ' || '15:30' THEN
1
WHEN srvb.rectarih1 || ' ' || srvb.rectime1 >= srvb.rectarih1 || ' ' || '15:30' 
AND srvb.rectarih1 || ' ' || srvb.rectime1 <  srvb.rectarih1 || ' ' || '23:30' THEN
2
ELSE
3
END AS shift,
srvb.rectarih1 || ' ' || srvb.rectime1 AS full_time,
srvb.rectarih1 AS job_start_date,
srvb.rectime1
FROM srvb00O srvb
LEFT JOIN srvbp0 srvp
ON srvp.kod = srvb.operatorkodu
LEFT JOIN srvb00 srv0
ON srv0.kod = srvb.kod
LEFT JOIN srvbc0 srvc
ON srvc.kod = srv0.cihazkartno
WHERE srvb.rectarih1 <> '          '
AND srvb.rectime1  <> '          '
AND srvb.rectarih2 <> '          '
AND srvb.rectime2  <> '          '
-- AND sysdate-TO_DATE(srvb.rectarih1,'YYYY/MM/DD')=1
ORDER BY srvb.kod DESC

这是清单的某些部分。

CODE
00000061820000006182000000618100000061810000006180000000618000000061790000006179000000617800000061780000006175000000617500000061740000006173000000617300000061700000006170000000616900000061690000006168000000616800000061670000006167000000616600000061660000006165000000616500000061640000006164000000616300000061630000006162000000616200000061610000006161000000616000000061600000006158000000615800000061570000006157000000615600000061560000006155000000615400000061540000006151000000615000000061480000006148000000614700000061470000006146000000614600000061450000006143000000614200000061410000006141000000614000000061400000006139000000613900000061380000006138000000613700000061370000006136000000613600000061340000006132000000613200000061310000006131000000613000000061300000006129000000612700000061270000006126000000612500000061240000006124000000612300000061230000006122000000612200000061210000006121000000612000000061200000006119000000611800000061180000006117000000611700000061160000006116000000611300000061130000006112000000611200000061110000006111000000611000000061100000006109000000610800000061080000006107000000610600000061050000006105000000610400000061040000006103000000610300000061020000006102000000610100000061010000006099000000609800000060970000006096
000000609500000060940000006094000000609300000060930000006092000000609200000060910000006091000000609000000060900000006086000000608600000060850000006085000000608400000060840000006083000000608300000060820000006082000000608100000060810000006077
000000607600000060750000006074000000607400000060720000006072000000607100000060700000006070000000606800000060680000006067
0000006066
000000606500000060640000006063000000606200000060610000006060000000605800000060580000006057

您可能在SRVB.RECTARIH1中有一些负值。(可能是伪数据)

检查导致RECTARIH1字段(..WHERE RECTARIH1<0)过滤错误的表

只是为了重新生成错误;

select TO_DATE ('-4714', 'YYYY') as t from dual;
"ORA-01841:"(full) year must be between -4713 and +9999, and not be 0" Cause: Illegal year entered Action: Input year in the specified range"

相关内容

  • 没有找到相关文章

最新更新