Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: VARRAY Object types for Numbers, how to avoid roundoff?

Re: VARRAY Object types for Numbers, how to avoid roundoff?

From: Dan McIntyre <mcintyre_at_pclink.com>
Date: Thu, 22 Jul 1999 11:27:36 -0500
Message-ID: <7n7h89$enb@enews3.newsguy.com>


Thanks for looking at my problem, I am using Oracle 8.0.5.0.0. Here are the declarations I used and a simple INSERT followed by a SELECT showing the rounded values which are supposed to be in NUMBER(6,2). Is there another way to retrieve collection type data from the database?

Thanks, Dan

Test SELECTS show the comparison method is working properly.

CREATE TYPE TDI_param_array_t AS VARRAY(100) OF NUMBER(6,2);

CREATE TYPE TDI_parameters_t AS OBJECT (

        TDI_param_array TDI_param_array_t,
        ORDER MEMBER FUNCTION isEqual (TDI_obj TDI_parameters_t) RETURN
INTEGER
);

desc TDI_parameters

 Name                            Null?    Type
 ------------------------------- -------- ----
 TDI_ID                          NOT NULL NUMBER(4)
 TDI_PARAM                         TDI_PARAMETERS_T
 INFILE                                  NUMBER(1)
 TDI_RISE_RATE                   NUMBER(6,2)


 INSERT INTO TDI_parameters VALUES ( 3, TDI_parameters_t(TDI_param_array_t(1.1, 2.2, 3.3, 4.4, 5.5, 6.6)), 1, 12.23);

1 row created.

 SELECT TDI_param from TDI_parameters WHERE TDI_param = TDI_parameters_t(TDI_param_array_t(1.1, 2.2, 3.3, 4.4, 5.5, 6.6));

TDI_PARAM(TDI_PARAM_ARRAY)




TDI_PARAMETERS_T(TDI_PARAM_ARRAY_T(1, 2, 3, 4, 6, 7)) Jonathan Lewis wrote in message
<932656473.4404.0.nnrp-13.9e984b29_at_news.demon.co.uk>...
>
>Can you give us a very simple example ?
>I have been trying to reproduce this on 8.1.5
>and keep getting full precision output.
>
>--
>
>Jonathan Lewis
>Yet another Oracle-related web site: www.jlcomp.demon.co.uk
>
>Dan McIntyre wrote in message <7n692c$2adq_at_enews4.newsguy.com>...
>>Hi,
>>
>> I am using the VARRAY collection data type both as a standalone column
>and
>>as an Object containing the array and I find that types defined as
VARRAY's
>>of , say, NUMBER(6,2) show only rounded off integers when retrieved from
>the
>>database. Comparison operators for the Object type indicate that the full
>>precision is being stored correctly. Is there a way to control the
display
>>user defined types and Objects when retrieved from the database?
>>
>
>
>
Received on Thu Jul 22 1999 - 11:27:36 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US