Academic Company Events NI Developer Zone Support Solutions Products & Services Contact NI MyNI
1 ratings:
 5 out of 5     Rate this Document

Querying Data of Type Numeric from Oracle Returns Incorrect Values

Primary Software: LabVIEW Toolkits>>Enterprise Connectivity Toolset
Primary Software Version: 3.0
Primary Software Fixed Version: N/A
Secondary Software: N/A

Problem: Can I retrieve correct data values using the Numeric data type in Oracle?

Solution: The data types number and numeric are exact numbers unlike floating point numbers. In Oracle, the field width and precision of these data types can be specified. The format of these numbers is:

NUMERIC ( precision, scale ),

where precision refers to the precision of a decimal number, and scale refers to the number of digits to the right of the decimal point. When the LabVIEW Database Connectivity Toolset is used to convert a numeric to either a single, double, or extended precision number it is important to determine whether it is possible to convert a specific Oracle numeric into a LabVIEW numeric data type. When passing a value from a database to LabVIEW it must first be converted into a specific ADO datatype. For example, by default, Numeric(8) is converted to ADO type 131, which is then converted to a double precision floating point number in LabVIEW. If the precision of the database datatype Numeric exceeds the precision of the LabVIEW data type, e.g. Numeric(38,19) being converted to a double precision number, then LabVIEW will return an incorrect data value without warning.

To prevent this error, read a high precision Oracle Numeric data type as a string in LabVIEW. Another option is to use a data type that is native to both LabVIEW and Oracle, such as DOUBLE PRECISION or INTEGER. This eliminates the the possibility of trying to interpret an Oracle data type that is beyond the precision of the numeric data types in LabVIEW.

Note: In Oracle, NUMERIC is synonymous with DECIMAL and NUMBER.

Related Links: Product Manuals: Database Connectivity Toolset User Manual, May 2001

Attachments:





Report Date: 04/19/2002
Last Updated: 11/30/2004
Document ID: 2KIAGIYP

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
  1 2 3 4 5
Please Contact NI for all product and support inquiries.submit