Export table from Access to Oracle converts number to Varchar how to make it stop doing that? - oracle

I have a table in Access 2007 with various number columns, but when i export the table from Access all the number fields are converted to varchar2. I am using an Access odbc for oracle

Use Number for Data Type and for field size use decimal

Related

Default precision scale data type in snowflake

I want to create a table with column as decimal and I dont want to specify any precision scale, it seems using number as dataType it create column as Number(38,0) by default.
How can I get some default value for scale as well.
In other db like oracle numeric takes default scale and we are able to insert decimal values but the same is not happening in snowflake
You are right that it is defined as NUMBER(38,0) when you don't specify a scale. It's a popular request from Snowflake users, and there is already a project to improve the NUMBER data type. Unfortunately, there is no ETA yet.
You can create a table with data type FLOAT/DECIMAL/DOUBLE etc, all these data types use underlying precision/scale = 15/9. It actually uses double data type internally.
You can try like
CREATE OR REPLACE TABLE table_double (
Scale REAL
);
insert into table_double values
(103269015259.46179);
insert into table_double values
(10326901.461);
It will truncate after 15/9.
Please refer to the documentation.
https://docs.snowflake.com/en/sql-reference/data-types-numeric.html#data-types-for-floating-point-numbers
Regards,
Sujan

Precision Issue when using OPENQUERY to insert values into Oracle table

I need to insert values with a precision of 5 decimal places into an Oracle interface table via OPENQUERY because the values are originally stored in an SQL database. The data type of the Oracle table column is NUMBER (with no scale/precision specified). Using OPENQUERY to insert a value of 1.4, results in a value of 1.3999999999999999 stored in the Oracle table. I cannot change the data type of the Oracle table to NUMBER(38,5) because it is a standard Oracle table (GL_DAILY_RATES_INTERFACE).
According to Oracle https://docs.oracle.com/cd/B28359_01/server.111/b28318/datatype.htm#CNCPT1832
"If a precision is not specified, the column stores values as given."
Which means that if I insert 1.4, it should be stored in a NUMBER column as is. But it doesn't. So does that mean that when inserting through OPENQUERY to a linked Oracle server, the Oracle Provider for OLE DB does some addition conversion that results in a floating point error?
How do I insert values to a precision of 5 decimal places into an Oracle table NUMBER column that does not have precision or scale specified?
Update:
My insert statement does round the values when inserting. But it doesn't solve the issue.
For example:
INSERT INTO OPENQUERY(LINKEDSERVER, "SELECT CONVERSION_RATE FROM GL_DAILY_RATES_INTERFACE") VALUES(ROUND(1.4,5))
Since inserting values through OPENQUERY to a linked Oracle server causes some floating point error, I tried using EXEC('') AT LINKEDSERVER and it worked. Because the statement is executed directly on the ORACLE server, there is no longer any issue of the Oracle Provider for OLE DB doing any unexpected conversion.
My overall solution was to first insert values from the SQL table to the Oracle table using OPENQUERY, then use EXEC() to update and round the values in the Oracle table again.

On retrieval from oracle value gets converted to float

A database in oracle with column datatype as NUMBER on retrieval using pyspark gets converted to float.
eg. ID column - datatype NUMBER has value 111
On retrieval the value is shown as 111.000000
The column names are dynamic and i dont want to CAST it by hard coding. Can the data in oracle be retrieved the way it appears in the database.
I don't want the zeroes to be appended.
select CAST(111.00000 AS NUMBER(38)) from dual

how to store an integer value in to sql table

i created this table and i want to be able to add Integer value of 99 in to Assgn_Id and Ben_Id. so i am very confident with my create table query.
Create table Advisor (
Advisor# Integer,
AdvisorName Varchar2(15),
Assgn_Id Integer,
Ben_Id Integer);
my second query is where i get confused. after i inserted the values into the table it seems like it work fine, but when i describe the table i see Number(38) datatype into both columns instead of Integers(99).
Insert Into Advisor (Assgn_Id, Ben_Id)
Values(99, 99);
Integer, INT, smallint are ansi defined data types - that Oracle has implemented as a number
I like to use integer for my tables because I'm lazy, it's easier to type.
From the docs..
SQL statements that create tables and clusters can also use ANSI data
types and data types from the IBM products SQL/DS and DB2. Oracle
recognizes the ANSI or IBM data type name that differs from the Oracle
Database data type name. It converts the data type to the equivalent
Oracle data type, records the Oracle data type as the name of the
column data type, and stores the column data in the Oracle data type
based on the conversions shown in the tables that follow.

What Oracle data type is easily converted to BIT in MSSQL via SSIS?

I have a Data Flow from an Oracle table to an MSSQL table with one field of data type BIT. The Oracle table is using the characters Y and N at the moment (I'm unsure of the data type and have no way of checking), but the MSSQL table needs to be data type BIT. What type of cast can I use on the Oracle query so that the data is pulled smoothly over?
Use char(1) and then use a derived column transformation like this:
(DT_BOOL)(OracleField == "Y"?1:0)
Give this column a name like OracleFieldAsBool
and then use it instead of the original column in the rest of your data flow.

Resources