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

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.

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

Oracle CLOB data type to Redshift data type

we are in the process of migrating Oracle tables to redshift tables. We found that few tables are having CLOB data type. In redshift we converted CLOB to Varchar(65535) type. While doing copy command , we are getting
The length of the data column investigation_process is longer than the length defined in the table. Table: 65000, Data: 90123.
Which data type we need to use? Please share your suggestion.
Redshift isn't designed to store CLOB (or BLOB) data. Most databases that do store the CLOB separately from the table contents to not burden all queries with the excess data. A CLOB reference is stored in the table contents and a replacement of CLOB for reference is performed at result generation.
CLOBs should be stored in S3 and references to the appropriate CLOB (S3 key) stored in the Redshift table. The issue is that there isn't a prepackaged tool for doing the CLOB for reference replacement with Redshift AFAIK. Your solution will need some retooling to perform this replacement actions for all data users. It's doable, it's just going to take a data layer that performs the needed replacement.

how to obtain blob type data for insertion in oracle?

hello friends I have a problem with the blob data type, I want to migrate some data from one bd to another bd however I have not been able to some tables that have blob type columns, what I have tried is to export a single record in the following way.
first I make a select of the record I want to export to my other bd
select TEMPLATE_DOCUMENT_ID,blob_file from example_table where template_document_id = 32;
then I export the result to obtain the insert
I configure as follows
when I do this I get a script with the data of the record that I want to migrate
if I run this it gives me the following error
Error report -
ORA-01465: invalid hex number
Do you have any idea how I could get the correct data to make my insert?
NOTE: MIGRATION IS DONE FROM ONE ORACLE DATABASE TO ANOTHER ORACLE DATABASE.
Obviously the source database is Oracle. You did not mention what is the target database. In case it is Oracle as well I would suggest using the Oracle Data Pump tool (expdp/impdp). Doc is here: https://docs.oracle.com/cd/B19306_01/server.102/b14215/dp_overview.htm
In case you need it, at least I use it quite often is the VIEW_AS_TABLE option of the tool as it allows me to export a subset of the data.

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's the ST_GEOMETRY type in Oracle?

Table Description is...
COLUMN NAME / DATA TYPE
------------------------------------------
MNUM VARCHAR2(33)
ALIAS VARCHAR2(200)
REMARK VARCHAR2(200)
NTFDATE VARCHAR2(8)
SGG_OID INTEGER
COL_ADM_SECT_CD VARCHAR2(5)
OBJECTID INTEGER
**SHAPE ST_GEOMETRY**
Does anybody know about Spatial information processing?
First of all, One of column's type in oracle is "ST_GEOMETRY" .
What is this kind of type?
And how can we migrate these kind of data to other oracle databse system?
ST_GEOMETRY is not native Oracle type. It is spatial type developed by esri and apparently it is installed on top of oracle database. I would assume that some ArcGIS products are using this database.
You can read more about this type in esri documentation. http://desktop.arcgis.com/en/arcmap/10.3/manage-data/gdbs-in-oracle/stgeometry-oracle.htm
The previous answer is misleading since it describes SDO Geometry which is another completely different spatial type developed by Oracle.
ST_GEOMETRY is a spatial data type. The use of the data type along with other supported data types are part of Oracle database's spatial technology. Apparently ST_GEOMETRY is also part of an ISO standard that Oracle supports.
You can migrate these objects and other data from Oracle database to database using data pump.
Oracle Spatial
Oracle Spatial Data Pump

Resources