Problem with Date format in oracOCI

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

sheema
Premium Member
Premium Member
Posts: 204
Joined: Sat Jul 22, 2006 10:20 am

Problem with Date format in oracOCI

Post by sheema »

I have a simple job it extracts data from a flat file and loads into a oracle table.I have 3 date fields coming from source file which are of datatype varchar and length 10 and it is coming in the format mm/dd/yyyy.I am converting them in the transformer using
ICONV(Date,"D/MDY[2,2,4]") and inserting into oracle table ABCD,the corresponding data type for these fields is Date in my oraOCI.The job is running fine,it is inserting rows into table ABCD.
But when i try to click view data in the oraOCI stage i am getting below error

ocixyz: ORA-01821: date format not recognized

ocixyz.DSLink1: DSP.Open GCI $DSP.Open error -100.

when i view the data in TOAD against table ABCD i can see the data.

can anyone let me know what might be the problem.

Thanks
sheema
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Are you also doing OCONV along with your ICONV? I didnt know oracle could accept internal formats :?
Look into your log file, do you have warnings?
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
sheema
Premium Member
Premium Member
Posts: 204
Joined: Sat Jul 22, 2006 10:20 am

Post by sheema »

I did not use OCONV.
I did not get any warning in my log.
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Ok. When you check the data using TOAD. Do you see correct data? Is it the same one that you inserted?
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
sheema
Premium Member
Premium Member
Posts: 204
Joined: Sat Jul 22, 2006 10:20 am

Post by sheema »

yes,that is the data which i am inserting.the date appears in mm/dd/yyyy format in TOAD.
narasimha
Charter Member
Charter Member
Posts: 1236
Joined: Fri Oct 22, 2004 8:59 am
Location: Staten Island, NY

Post by narasimha »

Change the data type from date to Timestamp and check if you get the same problem.
I still doubt all the data got loaded into your target table from your previous run, check if everythinig got loaded.
Narasimha Kade

Finding answers is simple, all you need to do is come up with the correct questions.
sheema
Premium Member
Premium Member
Posts: 204
Joined: Sat Jul 22, 2006 10:20 am

Post by sheema »

I checked the data,all the rows got loaded.I will check by changing the datatype to timestamp.
sheema
Premium Member
Premium Member
Posts: 204
Joined: Sat Jul 22, 2006 10:20 am

Post by sheema »

I changed the datatype to TimeStamp in my oraOCI but still i am getting the same error when i click the View Data option.
I knew that DB2 accepts internal date format,so i was not sure that Oracle also accepts the internal date format.
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

DB2 does. I dont think oracle does and hence my original question and doubt.
Try sending in your data as

Code: Select all

OCONV(ICONV(Date,"D/MDY[2,2,4]"),"D-YMD[4,2,2]")
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

sheema wrote:yes,that is the data which i am inserting.the date appears in mm/dd/yyyy format in TOAD.
Means nothing. Toad uses specific date masks for display, set in the options - can be anything you want.
sheema also wrote:I knew that DB2 accepts internal date format,so i was not sure that Oracle also accepts the internal date format.
Nope. I'm getting tired of explaining this over and over, guess that FAQ on the subject is long overdue.

All that matters is the format coming in your Sequential file. After that it's all 'standard' transforms to get it into a format the OCI stage will love:

YYYY-MM-DD HH24:MI:SS

Set your target datatype to Timestamp, use generated SQL, get the date into the output format shown above and append a zero timestamp to the end of the date. Oracle will love you for it.
-craig

"You can never have too many knives" -- Logan Nine Fingers
sheema
Premium Member
Premium Member
Posts: 204
Joined: Sat Jul 22, 2006 10:20 am

Post by sheema »

ok,Thanks for all the help.
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

chulett wrote:[ I'm getting tired of explaining this over and over, guess that FAQ on the subject is long overdue.
I say AYE AYE for that :wink:
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
narasimha
Charter Member
Charter Member
Posts: 1236
Joined: Fri Oct 22, 2004 8:59 am
Location: Staten Island, NY

Post by narasimha »

sheema wrote:ok,Thanks for all the help.
Does that mean your problem is resolved :wink:
If yes mark it as the same.
Narasimha Kade

Finding answers is simple, all you need to do is come up with the correct questions.
sheema
Premium Member
Premium Member
Posts: 204
Joined: Sat Jul 22, 2006 10:20 am

Post by sheema »

chulett,
I have used the format OCONV(ICONV(Date,"D/MDY[2,2,4]"),"D-YMD[4,2,2]"):"00:00:00" in my transformer and changed the datatype to Timestamp(19) and loaded into the table.
The data is getting loaded into the table.
But when i select the view data option i am getting the same error as i posted .
Last edited by sheema on Fri Jan 26, 2007 11:51 am, edited 1 time in total.
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

You forgot a space before the time part.

Code: Select all

OCONV(ICONV(Date,"D/MDY[2,2,4]"),"D-YMD[4,2,2]"):" 00:00:00"
I am just amazed as to how your data gets loaded with messed up data format and no warning shows up.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
Post Reply