FLOAT Data Type
Description
The
FLOAT
data type is a subtype ofNUMBER
. It can be specified with or without precision, which has the same definition it has forNUMBER
and can range from 1 to 126. Scale cannot be specified but is interpreted from the data. (Oracle Language Reference Float Data Type)
Notes on arithmetic operations
Please be aware that every operation performed on numerical datatypes is internally stored as a Number. Furthermore, depending on the operation performed it is possible to incur an error related to how intermediate values are stored within Snowflake, for more information please check this post on Snowflake's post on intermediate numbers in Snowflake.
Sample Source Patterns
Please, consider the following table and its inserts for the examples below:
Float data type in Create Table
Oracle
CREATE TABLE float_data_type_table(
col1 FLOAT,
col2 FLOAT(5),
col3 FLOAT(126)
);
INSERT INTO float_data_type_table (col1) VALUES (100.55555);
INSERT INTO float_data_type_table (col1) VALUES (1.9);
INSERT INTO float_data_type_table (col2) VALUES (1.23);
INSERT INTO float_data_type_table (col2) VALUES (7.89);
INSERT INTO float_data_type_table (col2) VALUES (12.79);
INSERT INTO float_data_type_table (col2) VALUES (123.45);
INSERT INTO float_data_type_table (col3) VALUES (1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111.99999999999999999999555555);
Snowflake
CREATE OR REPLACE TABLE float_data_type_table (
col1 FLOAT,
col2 FLOAT(5),
col3 FLOAT(126)
)
COMMENT = '{"origin":"sf_sc","name":"snowconvert","version":{"major":1, "minor":0},{"attributes":{"component":"oracle"}}'
;
INSERT INTO float_data_type_table(col1) VALUES (100.55555);
INSERT INTO float_data_type_table(col1) VALUES (1.9);
INSERT INTO float_data_type_table(col2) VALUES (1.23);
INSERT INTO float_data_type_table(col2) VALUES (7.89);
INSERT INTO float_data_type_table(col2) VALUES (12.79);
INSERT INTO float_data_type_table(col2) VALUES (123.45);
INSERT INTO float_data_type_table(col3) VALUES (1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111.99999999999999999999555555);
FLOAT
There are no differences between Oracle and Snowflake regarding FLOAT data type without precision.
Oracle
SELECT col1 FROM float_data_type_table;
Snowflake
SELECT col1 FROM
float_data_type_table;
FLOAT ( p )
Queries results may not be equivalent when the precision (p) is specified in theFLOAT
data type. There are small rounding differences.
Oracle
SELECT col2 FROM float_data_type_table;
SELECT col3 FROM float_data_type_table;
Snowflake
SELECT col2 FROM
float_data_type_table;
SELECT col3 FROM
float_data_type_table;
Known Issues
1. FLOAT data type with precision
When the FLOAT data type has precision, the queries results may have small rounding differences.
Related EWIs
No related EWIs.
Last updated