HP Neoview SQL Reference Manual page 247

Hide thumbs Also See for Neoview SQL:
Table of Contents

Advertisement

NUMERIC(19,4) sum. But because there are no user-specified extended precision columns,
the system casts the sum back to the user-specified type of NUMERIC(18,4).
CREATE TABLE T(a NUMERIC(18,4), B NUMERIC(18,4);
INSERT INTO T VALUES (1.1234, 2.1234);
>> SELECT A+B FROM T;
(EXPR)
--------------
3.246
If this behavior is not acceptable, you can use one of these options:
— Specify the column type as NUMERIC(19,4). For example, CREATE TABLE T(A
NUMERIC(19,4), B NUMERIC(19,4)); or
— Cast the sum as NUMERIC(19,4). For example, SELECT CAST(A+B AS
NUMERIC(19,4)) FROM T; or
— Use an extended precision literal in the expression. For example, SELECT
A+B*1.00000000000000000000 FROM T;.
Note the result for the previous example when changing to NUMERIC(19,4):
SELECT CAST(A+B AS NUMERIC(19,4)) FROM T;
(EXPR)
------------
3.2468
When displaying output results in NCI, casting a select list item to an extended precision
numeric type is acceptable. However, when retrieving an extended precision select list item
into an application program's host variable, you must first convert the extended precision
numeric type into a string data type. For example:
SELECT CAST(CAST(A+B AS NUMERIC(19,4)) AS CHAR(24)) FROM T;
(EXPR)
------------
3.2468
NOTE:
An application program can convert an externalized extended precision value in
string form into a numeric value it can handle. But, an application program cannot correctly
interpret an extended precision value in internal form.
Rules for Extended NUMERIC Precision Data Type
These rules apply:
No limit on maximum precision.
Supported in all DDL and DML statements where regular NUMERIC data type is supported.
Allowed as part of key columns for hash partitioned tables only.
NUMERIC type with precision 10 through 18.
— UNSIGNED is supported as extended NUMERIC precision data type
— SIGNED is supported as 64-bit integer
CAST function allows conversion between regular NUMERIC and extended NUMERIC
precision data type.
Parameters in SQL queries support extended NUMERIC precision data type.
Example of Extended NUMERIC Precision Data Type
>>CREATE TABLE t( n NUMERIC(128,30)) NO PARTITION;
Data Types
247

Advertisement

Table of Contents
loading

Table of Contents