-2

I have an issue with an old application. I tried to update date field with the value 01-JAN-99 but my application crash immediately. In fact, I saw a strange date value in the table when I get the value with oracle function dump(): Typ=12 Len=7: 1,1,1,1,1,1,1 and after I get the value with to_char(t$demi, 'SYYYY/MM/DD HH24:MI:SS') => 00000/00/00 00:00:00.

select 
 t$demi
 ,dump (t$demi) 
 ,to_char(t$demi, 'SYYYY/MM/DD HH24:MI:SS')
from 
T;

Result:

01-JAN-99   Typ=12 Len=7: 199,199,1,1,1,1,1  9999/01/01 00:00:00
01-JAN-99   Typ=12 Len=7: 1,1,1,1,1,1,1 00000/00/00 00:00:00

How to insert or update this kind of value in a existing table?

2
  • Related: stackoverflow.com/questions/12455152
    – user330315
    Sep 13, 2019 at 6:39
  • Please post the [SQL] UPDATE statement that crashed. If you got an error message, then post that also. For your information, Oracle's DATE data-type uses 7 (seven) bytes of storage. This old Oracle 9i documentation contains an example along with an explanation.
    – Abra
    Sep 13, 2019 at 7:16

1 Answer 1

0

Thanks for this post Trying to export a Oracle via PL/SQL gives a date of 0000-00-00

I converted the dump with dbms_stats.convert_raw_value('01010101010101', d) and I updated the table with the raw value

create table t42(dt date);

declare
    d date;
begin

    dbms_stats.convert_raw_value('01010101010101', d);
    insert into t42 (dt) values (d);
end;
/
select 
  dt,
  dump(dt), 
  to_char(dt, 'SYYYY/MM/DD HH24:MI:SS')
from t42

select * from t42 

resutlts

9999-01-01 00:00:00 Typ=12 Len=7: 1,1,1,1,1,1,1 00000/00/00 00:00:00

And very strange because the value is less than current date… 9999 is less than 2019!!!

select 
  dt,
  dump(dt), 
  to_char(dt, 'SYYYY/MM/DD HH24:MI:SS')
from t42
where dt < SYSDATE ;

9999-01-01 00:00:00 Typ=12 Len=7: 1,1,1,1,1,1,1 00000/00/00 00:00:00
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.