简体   繁体   English

如何从日期列的日期格式不同的源中获取Informatica中日期列的通用格式

[英]How to achieve a generic format for date column in Informatica from source having different format of date for date column

Period is a column coming from source which has dates in 3 different formats. 期间是一列来自来源的日期,它具有3种不同格式的日期。 I need to convert these to one single format that is 'MON-YY' and dump it into target table. 我需要将它们转换为“ MON-YY”的一种格式,然后将其转储到目标表中。

Source table : 来源表:

Period 
-------------------
JUN-17
JUN-2017
JUN-06-2017

Target table: 目标表:

Period 
-------------------
JUN-17
JUN-17
JUN-17

If you're sure you only have strings in those three formats you can just use the substr() function twice to get the start and end sections, and concatenate them back together: 如果确定只有这三种格式的字符串,则可以使用substr()函数两次来获取开始和结束部分,并将它们重新连接在一起:

select substr(period, 1, 4) || substr(period, -2)
from source_table

Demo with those values in a CTE: 在CTE中使用这些值进行演示:

with source_table(period) as (
            select 'JUN-17' from dual
  union all select 'JUN-2017' from dual
  union all select 'JUN-06-2017' from dual
)
select substr(period, 1, 4) || substr(period, -2)
from source_table;

SUBSTR
------
JUN-17
JUN-17
JUN-17

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM