Congratulations, keeper!
Type = 12 Linen = 7: 100,100,0,0,1,1,1,1
Elements in this dump are century, year, month, day, hour, minute, second. So, what you have there is 0-0-00000, which is definitely not a valid date ...
SQL> create table d (d1 date) 2 / Table created. SQL> insert into d values (to_date('00-00-0000', 'dd-mm-yyyy')) 2 / insert into d values (to_date('00-00-0000', 'dd-mm-yyyy')) * ERROR at line 1: ORA-01847: day of month must be between 1 and last day of month SQL>
change
I used Gary a great trick to break the zero date into a table ....
SQL> select * from d 2 / D1 --------- 00-DECEMB 19-JAN-10 SQL>
So, at least we know how your "magic" developers did it. Now all we have to do is get around their mind.
I think the only way to do this - and you probably won't like it - is to create an API layer using views ....
SQL> create or replace view v_d as 2 select case when d1 = trash_date then null else d1 end as d1 3 from d 4 / View created. SQL> select * from v_d 2 / D1 --------- 19-JAN-10 SQL>
Not the most troubling aspect of this is that you will need INSTEAD IF triggers that actually insert null dates into the base table (again, using the Gary function). In addition, to support the same object names, you probably need to build the API in a different scheme.
Therefore, I do not minimize the amount of work that is involved. The problem is that previous developers faced a lot of technical debt with their solution. Now you do not need to pay a whig for this debt (given that you do not want to pay off the capital by rewriting the database).
last news
I just met this funny date in my own environment, which offers an alternative explanation of these funny dates. I added a DATE column to the table in which the rows were. I used the DEFAULT clause to set the default value for sysdate. Guess what happened?
SQL> select * from t69 2 / ID ---------- 1 2 SQL> alter table t69 add col2 date default sysdate not null 2 / Table altered. SQL> select * from t69 2 / ID COL2 ---------- --------- 1 00-DECEMB 2 00-DECEMB SQL>
For the record, sysdate works as expected for newlines ...
SQL> insert into t69 (id) values (3) 2 / 1 row created. SQL> select * from t69 2 / ID COL2 ---------- --------- 1 00-DECEMB 2 00-DECEMB 3 28-APR-10 SQL>