[英]Oracle column with Timestamp(6) data type extract using ssis
I am trying to pull an oracle table data into sql server using SSIS. 我正在尝试使用SSIS将oracle表数据拉入sql服务器。 I have a package variable that holds the source query that needs to be fired in the oracle db.I have a data flow task with oledb source(oracle) and oledb destination(sql server).
我有一个包含要在oracle db中触发的源查询的包变量。我有一个带有oledb source(oracle)和oledb destination(sql server)的数据流任务。
The oledb source query(variable) is as follows oledb源查询(变量)如下
Select A,B,C
From "Table" TT
Where C in (Select coalesce(ab,cd) as c
From "Table" T2
Where Last_Upd_Dt >= '2018-09-24 12:00:00')
The column Last_Upd_Dt
is a TimeStamp(6)
with default value of LocalTimeStamp
in the source oracle DB 列
Last_Upd_Dt
是一个TimeStamp(6)
具有默认值LocalTimeStamp
在源Oracle数据库
My question is in what format should my input parameter value be so that I dont have to convert the Last_Upd_Dt
column to TO_DATE()
, TO_CHAR()
etc. 我的问题是输入参数值应采用哪种格式,这样我
Last_Upd_Dt
列转换为TO_DATE()
, TO_CHAR()
等。
If I run that query using SSIS I get 如果我使用SSIS运行该查询,我会得到
ORA-01843 : not a valid month
ORA-01843 : 无效月份
Just use 只需使用
... Where Last_Upd_Dt >= to_date('2018-09-24 12:00:00','yyyy-mm-dd hh24:mi:ss')
or 要么
... Where Last_Upd_Dt >= timestamp'2018-09-24 12:00:00'
you may refer the following demonstration : 您可以参考以下演示:
SQL> create table tab ( id int not null, time timestamp(6) default LocalTimeStamp not null );
Table created
SQL> insert into tab(id) values(1);
1 row inserted
SQL> select * from tab t;
ID TIME
-- --------------------------
1 26/09/2018 08:23:23,068025
SQL> select * from tab where Last_Upd_Dt >= to_date('2018-09-24 12:00:00','yyyy-mm-dd hh24:mi:ss');
ID TIME
-- --------------------------
1 26/09/2018 08:23:23,068025
SQL> select * from tab where Last_Upd_Dt >= timestamp'2018-09-24 12:00:00';
ID TIME
-- --------------------------
1 26/09/2018 08:23:23,068025
SQL> select * from tab where Last_Upd_Dt >= to_date('2018-09-26 12:00:00','yyyy-mm-dd hh24:mi:ss');
ID TIME
-- --------------------------
--> no rows selected
Oracle supports the DATE
and TIMESTAMP
keywords. Oracle支持
DATE
和TIMESTAMP
关键字。 You can express the logic as: 您可以将逻辑表示为:
where Last_Upd_Dt >= TIMESTAMP '2018-09-24 12:00:00'
If you did not have a time component, you would do: 如果没有时间部分,则可以执行以下操作:
where Last_Upd_Dt >= DATE '2018-09-24'
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.