Date Format

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
jagadam
Premium Member
Premium Member
Posts: 107
Joined: Wed Jul 01, 2009 4:55 pm
Location: Phili

Date Format

Post by jagadam »

I have tab delimited source file from that i am getting the date column in the format "dd-mon-yy" or "d-mon-yy" but, i need to load into oracle table with the default format. Plz help me how to achieve this.
NJ
jwiles
Premium Member
Premium Member
Posts: 1274
Joined: Sun Nov 14, 2004 8:50 pm
Contact:

Post by jwiles »

First, what is the datatype of the table column you will be loading the date into?

Date formats and loading dates into Databases has been discussed and resolved many times in the forum. Please take a little time to use the search function!

Regards,
- james wiles


All generalizations are false, including this one - Mark Twain.
prakashdasika
Premium Member
Premium Member
Posts: 72
Joined: Mon Jul 06, 2009 9:34 pm
Location: Sydney

Post by prakashdasika »

Read the date field from source file as a varchar field. Use a stringtodate function in a transformer stage to change it to the required format before loading it to database.
Prakash Dasika
ETL Consultant
Sydney
Australia
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

There's no such thing as a default format for Oracle. You set your own date picture (or the DBA may have done it for you). Let's assume it's YYYY-MM-DD, which is also the ISO 8601 standard.

You now have two problems - how to correctly add the century to your two digit years, and how to reorder the components converting an alphabetic month to a numeric representation.

Use two StringToDate() conversion, one for each of your formats, governed by If..Then..Else to decide which format to convert, and providing an appropriate format string for each.

Once the internal data type is Date, the Oracle Connector should handle it gracefully.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply