Page 1 of 1

Date format writing to oracle

Posted: Mon Mar 15, 2010 8:47 am
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

Posted: Mon Mar 15, 2010 8:55 am
by Sainath.Srinivasan
Can you post the syntax of StringToDate and how you used it so others can guide you.

Re: Date format

Posted: Mon Mar 15, 2010 9:18 am
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.

Re: Date format

Posted: Mon Mar 15, 2010 10:16 am
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

Posted: Mon Mar 15, 2010 10:33 am
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.

Posted: Tue Mar 16, 2010 7:37 am
by aladap12
Thanks for the response.

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

Thanks
Vkr

Posted: Tue Mar 16, 2010 7:57 am
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.