Page 1 of 1

Unhandled conversion error in modify stage.

Posted: Fri Feb 02, 2007 12:59 am
by videsh77
After I try to convert string format of date value to a date data type using modify stage, I get error below.

APT_CombinedOperatorController,2: Un-handled conversion error on field "JoiningDate " from source type "string" to destination type "date":
source value="16-12-2002"; the result is non-nullable and there is no handle_null to specify a default value.

Specification used in Modify stage is as below -
Joining_Date_Column:date=date_from_string(JoiningDate)

I am unable to get, where I have made a mistake. Can you please help me out to find out the problem?

Posted: Fri Feb 02, 2007 1:11 am
by balajisr
You have not specified your date format in the specification.

Code: Select all

Joining_Date_Column:date=date_from_string[%dd-%mm-%yyyy](JoiningDate) 

Posted: Fri Feb 02, 2007 2:07 am
by videsh77
Problem resolved. Thanks.

Posted: Fri Feb 02, 2007 2:46 am
by videsh77
My final intention is to get day of the year.

To achieve this I have converted String representation day into date format. Further I tried to get day of year by using 'year_day_from_date' function within same Modify stage.

For this I get runtime error. If I have to convert String format of a date to the day of the year, How I can do this?

Posted: Fri Feb 02, 2007 3:24 am
by balajisr
Can you post your error message and your specification?
Also, Nested specification will not work in modify stage.
If you are working in datastage 7.5.1A version you can also consider to do this in transformer rather than modify stage

Posted: Fri Feb 02, 2007 3:34 am
by videsh77
Specification to convert string to int day of the year, is as below -

Joining_Day:int8=year_day_from_date(date_from_string[%dd-%mm-%yyyy](JoiningDate))

For this specification, I am getting following error.

main_program: Error parsing modify adapter: Error in binding: Error in source field selector: Expected integer, got: "%"
Expected destination field selector, got: ")"; input:
Joining_Date_Column:date=date_from_string[%dd-%mm-%yyyy](JoiningDate)
;
Joining_Day:int8=year_day_from_date(date_from_string[%dd-%mm-%yyyy](JoiningDate))


NOTE : If I convert string to date individually it is working fine.

Posted: Mon Feb 05, 2007 4:02 am
by videsh77
Can we have, two or more specifications together for the derivation of a single column, as described in my previous post?

Posted: Mon Feb 05, 2007 4:03 am
by videsh77
Can we have, two or more specifications together for the derivation of a single column, as described in my previous post?

Posted: Mon Feb 05, 2007 4:56 am
by videsh77
Can we have, two or more specifications together for the derivation of a single column, as described in my previous post?

Posted: Mon Feb 05, 2007 5:57 am
by balajisr
Read my previous post. I posted that nested specification is not available in modify stage.
One alternative would be to have two successive modify stages or use transformer.