Page 1 of 1

Interval Day to Second

Posted: Wed 19 Dec 2012 20:45
by jdorlon
Hello,

If I call TSmartQuery.Prepare, and there is a field that is INTERVAL DAY(x) TO SECOND(Y), I know that I can discover the X-value with FieldDesc.Length. How can I discover the Y value? I know I can discover it if I execute the query, but is there a way to find it having only prepared the query?

thank you,

John Dorlon

Re: Interval Day to Second

Posted: Thu 20 Dec 2012 14:33
by AlexP
Hello,

Unfortunately, at the moment, it is impossible to retrieve this value. We will consider the possibility to add such functionality in the next versions.

Re: Interval Day to Second

Posted: Thu 20 Dec 2012 16:00
by jdorlon
Thank you. I was also unable to determine the scale on FLOAT columns. So, FLOAT(10) looked the same as FLOAT(20) which looked the same as FLOAT. If you could also take a look at that one, I would appreciate it.

Re: Interval Day to Second

Posted: Fri 21 Dec 2012 11:41
by AlexP
Hello,

There is a code below returning fields Precision and Scale NUMBER

Code: Select all

CREATE TABLE TEST_NUMBER
(
  F_ID NUMBER NOT NULL,
  F_10 NUMBER(10),
  F_20 NUMBER(20),
  F_NUMBER NUMBER,
  F_3_5 NUMBER(3,5),
  F_7_4 NUMBER(7,4)
)

Code: Select all

var
  i: integer;
begin
  OraQuery1.SQL.Text := 'SELECT * FROM TEST_NUMBER' ;
  OraQuery1.Prepare;
  for i := 1 to OraQuery1.FieldCount do
    ShowMessage(Format('Field: %s(%d,%d)',[OraQuery1.GetFieldDesc(i).Name,
                                          OraQuery1.GetFieldDesc(i).Length,
                                          OraQuery1.GetFieldDesc(i).Scale]));
end;

Re: Interval Day to Second

Posted: Fri 21 Dec 2012 14:39
by jdorlon
For NUMBER columns, what you say is true. FLOAT is not just a synonym for NUMBER. Try it with FLOAT and you'll see what I mean.

Code: Select all

CREATE TABLE TEST_NUMBER
(
  F_ID        NUMBER                            NOT NULL,
  F_10        NUMBER(10),
  F_20        NUMBER(20),
  F_NUMBER    NUMBER,
  F_3_5       NUMBER(3,5),
  F_7_4       NUMBER(7,4),
  F_FLOAT     FLOAT,
  F_FLOAT_10  FLOAT(10),
  F_FLOAT_20  FLOAT(20)
);

Re: Interval Day to Second

Posted: Mon 24 Dec 2012 11:52
by AlexP
Hello,

Thank you for the information. We have reproduced the problem with defining of the FLOAT fields precision, and will try to fix it in the nearest version of the product.

Re: Interval Day to Second

Posted: Tue 12 Feb 2013 12:29
by AlexP
Hello,

We have fixed the behaviour when using INTERVAL types, now, you can retrieve both X and Y values in the INTERVAL DAY(x) TO SECOND(Y) type.
When using FLOAT values, binary precision is used (decimal precision - in NUMBER), and since we don't use metadata to retrieve precision, we set values returned by server. If you want to use values set when creating the table, you can use the TOraMetaData component for this.

Re: Interval Day to Second

Posted: Tue 12 Feb 2013 14:10
by jdorlon
Thank you Alex.

Re: Interval Day to Second

Posted: Wed 27 Feb 2013 17:01
by jdorlon
Hi Alex,

I see the comment in the latest version about this, but I don't see the information in TFieldDesc. Stepping into TSmartQuery.Prepare, I can find it in TCRFieldDesc, but I don't know how to find that from TFieldDesc. Am I missing something?

thanks,

John