Page 1 of 1

TIMESTAMP(0) problem

Posted: Fri 07 Dec 2012 15:48
by jdorlon
Hello,

I have a table that was created like this:

Code: Select all

create table ts_zero
(ts_zero_col timestamp(0));

insert into ts_zero
select systimestamp
from dual;

commit;
Now, when I select from it with a TSmartQuery attached to a TDBGrid, the format is this:

12/7/2012 9:35:03. AM

Notice the extra dot after the seconds. There are no fractional seconds because it is TIMESTAMP(0), so the dot shouldn't be there either.

It presents a problem when I take that data and try to put it into a TO_TIMESTAMP() expression because the data format does not match what I see in TOraTimeStamp.Format.

I am using the latest ODAC version. If there is a change I can make to the ODAC source to fix it without having to wait for an update, please let me know.

Thanks,

John Dorlon

Re: TIMESTAMP(0) problem

Posted: Fri 07 Dec 2012 16:08
by jdorlon
Ah! I believe I've found the solution.

In OraClasses, TOraTimeStamp.SetFormat...

Change this

Code: Select all

        's','S': begin
          Inc(P);
          if AnsiPos('Z', UpperCase(Str)) = 0 then begin
            Temp := {$IFDEF VER16P}FormatSettings.{$ENDIF}DecimalSeparator + 'FF'; // + IntToStr(Precision); does not work on Oracle 9.0.1
          end else
to this

Code: Select all

        's','S': begin
          Inc(P);
          if (AnsiPos('Z', UpperCase(Str)) = 0) and (Precision > 0) then begin
            Temp := {$IFDEF VER16P}FormatSettings.{$ENDIF}DecimalSeparator + 'FF'; // + IntToStr(Precision); does not work on Oracle 9.0.1
          end else
I added "and (Precision > 0)".

If you agree with this solution, please include it in the next version. Thank you.

-John

Re: TIMESTAMP(0) problem

Posted: Mon 10 Dec 2012 11:08
by AlexP
Hello,

Thank you for the information, we have reproduced the problem, and will include the changes to the next ODAC version.