Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

LINK TO THIS FORUM!

Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Feedback

"...Your site was well structured and I found what I was looking for in about 2 minutes. I am looking forward to participating with you in the future..."

Geography

Where in the world do Tek-Tips members come from?
mirogak (Programmer)
21 Feb 08 11:16
Hi,

Using:
PowerCenter 7.1.5
Database : Oracle 8i

Source table has a column (SOURCE_COL) with string data type but has date values in it, in this format '09-MAR-2007'

Target table has a column (TARGET_COL) with date data type. The date format in this database is 'MM/DD/YYYY'

So, I use an expression transformation to convert to date format using the TO_DATE function. However, this does not work.

In the expression transformation I created 3 ports:
IN_SOURCE_COL (string type)
VAR_SOURCE_COL (date type)
- here, I use the formula "TO_DATE(IN_SOURCE_COL,'MM/DD/YYYY')"
OUT_SOURCE_COL (date type)
- here, I simply call VAR_SOURCE_COL

I then connect the OUT_SOURCE_COL to the TARGET_COL. I get a valid expression and mapping. And the workflow executes fine, however, it does not actually write anything to that target column. I get the following error message in the log file:

" Error message is [<<Expression Error>> [TO_DATE]: invalid string for converting to Date "

So, it seems that PowerCenter can't convert this string '09-MAR-2007' to this date format '3/9/2007'

Can anyone help here?

Thanks,
Mirogak
ArtieChoke (Programmer)
21 Feb 08 23:47
I believe you need to tell it what format the string date is in, not what you want it to return. It is going to return a date type and format has nothing to with that at the target.

"I think we're all Bozos on this bus!" - Firesign Theatre jester

blom0344 (TechnicalUser)
22 Feb 08 6:16
I recall formatting the date (from source) to the correct string representation and then using to_date function to get the proper date format. So, a 2-step exercise always worked for me..

Ties Blom
 

rasETL (IS/IT--Management)
22 Feb 08 13:48
Here is some code which is coverting a 26 character string to datetime...

TO_DATE(SUBSTR(in_DATE1, 0, 19),'YYYY-MM-DD HH24:MI:SS')

Hope that helps.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close