Date format writing to oracle

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
aladap12
Participant
Posts: 60
Joined: Fri Jul 20, 2007 1:15 pm
Location: NO

Date format writing to oracle

Post by aladap12 »

Hi All,

I have a issue with date format.

We are reading from seq file and loading in oracle db.
In source stage I am getting a date column as 'mm-dd-yyyy.hh.mm.ss' and it is having char data type in source side.

We are loding that in to date column (date (data type)) in oracle table.

Question is I have insert to table in format line 'dd/mm/yyyy'

I have used several fuction like string todate and all.

Is theere any way to do that . Please advise me.

I appriciate your time and patience.

Thanks
VKR
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

Can you post the syntax of StringToDate and how you used it so others can guide you.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Re: Date format

Post by chulett »

aladap12 wrote:I have insert to table in format like 'dd/mm/yyyy'
No, you don't. Unfortunately, if you think you do, that means you don't really understand DATE fields or how to work with them via SQL.

What is your target stage? Is the SQL generated or user-defined? Those answers will help figure out what really needs (or should) happen.
-craig

"You can never have too many knives" -- Logan Nine Fingers
aladap12
Participant
Posts: 60
Joined: Fri Jul 20, 2007 1:15 pm
Location: NO

Re: Date format

Post by aladap12 »

chulett wrote:
aladap12 wrote:I have insert to table in format like 'dd/mm/yyyy'
No, you don't. Unfortunately, if you think you do, that means you don't really understand DATE fields or how to work with them via SQL.

What is your target stage? Is the SQL generated or user-defined? Those answers will help figure out what really needs (or should) happen.

***********************************************************

target stage is oracle table, and it is genarated sql.

Thanks
Vkr
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Target stage please, Oracle Enterprise? If so, set to what Write Method? What data type are you using in the job itself for this field - Date or Timestamp? Can you post the generated SQL?

The more details you provide up front, the sooner we can stop dancing and get you to a proper solution.
-craig

"You can never have too many knives" -- Logan Nine Fingers
aladap12
Participant
Posts: 60
Joined: Fri Jul 20, 2007 1:15 pm
Location: NO

Post by aladap12 »

Thanks for the response.

Target stage is Oracle Enterprise.
We are using upsert and the field data type is date.

Thanks
Vkr
kogads
Premium Member
Premium Member
Posts: 74
Joined: Fri Jun 05, 2009 5:36 pm

Post by kogads »

Assuming you are reading data in one field
field1 -> 'mm-dd-yyyy.hh.mm.ss'
StringTodate(field1[1,10],'%mm-%dd-%yyyy') should work.
Post Reply