date format from flatfile to oracle database

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
vardhan354
Participant
Posts: 76
Joined: Wed Jan 25, 2006 6:42 pm

date format from flatfile to oracle database

Post by vardhan354 »

Hi,

first scenario:-

source database:- oracle date(column name) --- varchar

target database:- flatfile date(column name) ---- varchar

can i use any function for this.

Second:-

source flatfile:- date (column name):- varchar
Target database:- oracle date(column name):- Time stamp.

i am using this function as

oconv(iconv(Linkname.columnname, "D-DMY[2,2,4]"), "D-YMD[4,2,2]"):"00:00:00

the source format in flatfile is :- DD-MM-YYYY.

Third:-

source flatfile:- date column (varchar):-
Target :- oracle;- date column (Timestamp)

i am using function as

oconv(iconv(Linkname.columnname, "D-DMY[2,2,4]"), "D-YMD[4,2,2]"):"00:00:00"

The flatfile (date format) is DD-MM-YYYY.


Please help me that i am using correct functions in my,
when i am using the above function the date columns records are not loading into the target.

Thanks in advance.
ETL
thumsup9
Charter Member
Charter Member
Posts: 168
Joined: Fri Feb 18, 2005 11:29 am

Post by thumsup9 »

Try this:

oconv(iconv(Linkname.columnname, "D-MDY[2,2,4]"), "D-YMD[4,2,2]"):"00:00:00"
DeepakCorning
Premium Member
Premium Member
Posts: 503
Joined: Wed Jun 29, 2005 8:14 am

Post by DeepakCorning »

If you can take care of the spaces in the function then it will work fine. I see some spaces missing (Can not say for sure as I was not able to read it very properly)
Correct one --
Oconv(Iconv(ColumnName, "D-DMY[2,2,4]") , "D-YMD[4,2,2]")

Also I think so even if you do not append the Time then also Oracle Target will take care of it.
thumsup9
Charter Member
Charter Member
Posts: 168
Joined: Fri Feb 18, 2005 11:29 am

Post by thumsup9 »

thumsup9 wrote:Try this:

oconv(iconv(Linkname.columnname, "D-MDY[2,2,4]"), "D-YMD[4,2,2]"):"00:00:00"
Sorry, you said the format was DD-MM-YYYY, check this

oconv(iconv(Linkname.columnname, 'D-MDY[2,2,4]'), 'D-YMD[4,2,2]') : ' 00:00:00'
vardhan354
Participant
Posts: 76
Joined: Wed Jan 25, 2006 6:42 pm

Post by vardhan354 »

Thanks for the response.

Hi deepak/Thumsup9,

please suggest me which is the exact format

D-DMY or D-MDY

and i also checked there are no spaces in the function.

i tried for both,but it is not loading any data.

please help me .

Thanks in advance
ETL
thumsup9
Charter Member
Charter Member
Posts: 168
Joined: Fri Feb 18, 2005 11:29 am

Post by thumsup9 »

It should be D-DMY
thumsup9
Charter Member
Charter Member
Posts: 168
Joined: Fri Feb 18, 2005 11:29 am

Post by thumsup9 »

vardhan354 wrote:Thanks for the response.

Hi deepak/Thumsup9,

please suggest me which is the exact format

D-DMY or D-MDY

and i also checked there are no spaces in the function.

i tried for both,but it is not loading any data.

please help me .

Thanks in advance

Vardhan,

Whats the format on the database. Can you please check the format.
kris007
Charter Member
Charter Member
Posts: 1102
Joined: Tue Jan 24, 2006 5:38 pm
Location: Riverside, RI

Post by kris007 »

Oracle accepts date format in format

Code: Select all

YYYY-MM-DD HH24:MI:SS
. The derivation

Code: Select all

Oconv(Iconv(ColumnName, "D-DMY[2,2,4]") , "D-YMD[4,2,2]") 
should work fine as long as you have given the input date format correct in your earlier post. Can you confirm your input date format once again?
Kris

Where's the "Any" key?-Homer Simpson
vardhan354
Participant
Posts: 76
Joined: Wed Jan 25, 2006 6:42 pm

Post by vardhan354 »

The target (oracledatabase) "DATE"
ETL
DeepakCorning
Premium Member
Premium Member
Posts: 503
Joined: Wed Jun 29, 2005 8:14 am

Post by DeepakCorning »

Should be DMY , I think he mentioned it is a timestamp in the DB...
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Whatever you provide it must match the date picture specified for Oracle.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
NBALA
Participant
Posts: 48
Joined: Tue Jul 11, 2006 11:52 am
Location: IL, USA

Post by NBALA »

Hi,

Any one please help me !

I have a date and time format like '20061003191438' (yyyymmddHHmmss) as input date from source. I want to load this in Oracle date.

I have tried with 'DateYearFirstToOraOCIWithTime' but its returnig with some date with charaters like 2016-BC-07...

Any suggestion appreciated.

Thanks
-NB
kcbland
Participant
Posts: 5208
Joined: Wed Jan 15, 2003 8:56 am
Location: Lutz, FL
Contact:

Post by kcbland »

How about a derivation of

Code: Select all

inlink.col[1,4]:"-":inlink.col[5,2]:"-":inlink.col[7,2]:" ":inlink.col[9,2]:":":inlink.col[11,2]:":":inlink.col[13,2] 
and then let auto-generated SQL add the to_date for you automatically?
Kenneth Bland

Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
NBALA
Participant
Posts: 48
Joined: Tue Jul 11, 2006 11:52 am
Location: IL, USA

Post by NBALA »

Thanks a lot Ken!

Wow ! It worked Great !

Thanks again.
-NB
Post Reply