Attempt to convert String value to Date type unsuccessful
Moderators: chulett, rschirm, roy
Attempt to convert String value to Date type unsuccessful
Hi ,
i am trying to load the date field from source into target column as it is.
source is flatfile.date format is MM/DD/YYYY, target is oracle9.2 column is defined as DATE.
the following error raising ,
while processing column "Call_Start_Date_Time" Value treated as NULL
Attempt to convert String value "02/09/05" to Date type unsuccessful
any idea what's wrong here..Thanks
i am trying to load the date field from source into target column as it is.
source is flatfile.date format is MM/DD/YYYY, target is oracle9.2 column is defined as DATE.
the following error raising ,
while processing column "Call_Start_Date_Time" Value treated as NULL
Attempt to convert String value "02/09/05" to Date type unsuccessful
any idea what's wrong here..Thanks
-
- Participant
- Posts: 3337
- Joined: Mon Jan 17, 2005 4:49 am
- Location: United Kingdom
OConv(IConv(YourDate, 'D/MDY[2,2,4]'), 'D-DMY[2,A3,4]')
for date
OR
OConv(IConv(YourDate, 'D/MDY[2,2,4]'), 'D-YMD[4,2,2]') : ' 00:00:00'
for timestamp
for 'mm/dd/yyyy' mentioned as format in your post
OR
OConv(IConv(YourDate, 'D/MDY[2,2,2]'), 'D-DMY[2,A3,4]')
for date
OR
OConv(IConv(YourDate, 'D/MDY[2,2,2]'), 'D-YMD[4,2,2]') : ' 00:00:00'
for timestamp
for 'mm/dd/yy' mentioned in form of data in your post
for date
OR
OConv(IConv(YourDate, 'D/MDY[2,2,4]'), 'D-YMD[4,2,2]') : ' 00:00:00'
for timestamp
for 'mm/dd/yyyy' mentioned as format in your post
OR
OConv(IConv(YourDate, 'D/MDY[2,2,2]'), 'D-DMY[2,A3,4]')
for date
OR
OConv(IConv(YourDate, 'D/MDY[2,2,2]'), 'D-YMD[4,2,2]') : ' 00:00:00'
for timestamp
for 'mm/dd/yy' mentioned in form of data in your post
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Find out what your default Oracle date picture is.
Then make sure that whatever you're passing to the OCI stage matches this format precisely using Iconv/Oconv functions or substring/concatenation techniques.
Code: Select all
SELECT date_column FROM table;
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
i entered some date into XSl sheet in the format 02/09/2005 and saved it as .CSV
then ftp'd the file to the server
and RAY the column can accept date as 02/09/2005 (i have one more column as date and it's accepting the derivation DATE() )
although it look like stright forward ,but some how throwing errors
LdConnectedXXXHistory..Transformer_2: At row 16, link "DSLink4", while processing column "Call_Start_Date_Time" Value treated as NULL
Attempt to convert String value "09/02/2005" to Date type unsuccessful
then ftp'd the file to the server
and RAY the column can accept date as 02/09/2005 (i have one more column as date and it's accepting the derivation DATE() )
although it look like stright forward ,but some how throwing errors
LdConnectedXXXHistory..Transformer_2: At row 16, link "DSLink4", while processing column "Call_Start_Date_Time" Value treated as NULL
Attempt to convert String value "09/02/2005" to Date type unsuccessful
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
If it's accepting Date() then it appears that the stage is expecting a date in DataStage internal format.
Try using just the Iconv(), omitting the Oconv() from your derivation.
Try using just the Iconv(), omitting the Oconv() from your derivation.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
-
- Participant
- Posts: 3337
- Joined: Mon Jan 17, 2005 4:49 am
- Location: United Kingdom
-
- Participant
- Posts: 6
- Joined: Mon Dec 27, 2004 3:32 pm
[quote="ray.wurlod"]If it's accepting Date() then it appears that the stage is expecting a date in DataStage internal format.
Try using just the Iconv(), omitting the Oconv() from your derivation.[/quote]
Greetings, all.
Ray, your suggestion to drop the Oconv() solved my problem as well.
I thank you kindly.
My only question now is, does anyone know how to write the date format so that the leading zeros are retained?
When I use (IConv(Input.MY_DT,'D2/MDY[2,2,4]')), I always get the date back without the leading zeros...ie.q. 2/5/2005 instead of 02/05/2005.
Any ideas?
Thanks, all
john
Try using just the Iconv(), omitting the Oconv() from your derivation.[/quote]
Greetings, all.
Ray, your suggestion to drop the Oconv() solved my problem as well.
I thank you kindly.
My only question now is, does anyone know how to write the date format so that the leading zeros are retained?
When I use (IConv(Input.MY_DT,'D2/MDY[2,2,4]')), I always get the date back without the leading zeros...ie.q. 2/5/2005 instead of 02/05/2005.
Any ideas?
Thanks, all
john
-
- Participant
- Posts: 6
- Joined: Mon Dec 27, 2004 3:32 pm
[quote="ketfos"]Hi,
As mentioned earlier
OConv(IConv(YourDate, 'D/MDY[2,2,2]'), 'D-MDY[2,A3,4]')
the above routine returns date as 02/09/2005 if YourDate = 02092005
Ketfos[/quote]
Thanks for the response...fyi...I tried your idea before I sent my question, and I retried it....I just cut and pasted your response as you sent it, and it still doesn't give the leading zeros..
I also used OConv(IConv(Input.TRANS_DT, 'd/mdY[2,2,2]'), 'd-mdY[2,A3,4]')
and stilll no leading zeros. I read somewhere that for some op sys using an upper case "D" removed the leading zero for days less than 10 and lower case "d" retained the leading zeros...same for M and m for the months....but I haven't been able to prove it works for DataStage as to whether it is case sensitve or not.
Any other thoughts ?
thanks for the response, though...it was a good thought.
john
As mentioned earlier
OConv(IConv(YourDate, 'D/MDY[2,2,2]'), 'D-MDY[2,A3,4]')
the above routine returns date as 02/09/2005 if YourDate = 02092005
Ketfos[/quote]
Thanks for the response...fyi...I tried your idea before I sent my question, and I retried it....I just cut and pasted your response as you sent it, and it still doesn't give the leading zeros..
I also used OConv(IConv(Input.TRANS_DT, 'd/mdY[2,2,2]'), 'd-mdY[2,A3,4]')
and stilll no leading zeros. I read somewhere that for some op sys using an upper case "D" removed the leading zero for days less than 10 and lower case "d" retained the leading zeros...same for M and m for the months....but I haven't been able to prove it works for DataStage as to whether it is case sensitve or not.
Any other thoughts ?
thanks for the response, though...it was a good thought.
john
-
- Participant
- Posts: 3337
- Joined: Mon Jan 17, 2005 4:49 am
- Location: United Kingdom
-
- Participant
- Posts: 3337
- Joined: Mon Jan 17, 2005 4:49 am
- Location: United Kingdom
-
- Participant
- Posts: 6
- Joined: Mon Dec 27, 2004 3:32 pm
[quote="Sainath.Srinivasan"]Small correction, it must be
OConv(IConv(YourDate, 'D/MDY[2,2,4]'), 'D-DMY[2,A3,4]')
(for a 4 digit year part as given in the example)[/quote]
How very odd !
javascript:emoticon(':?')
Confused
I edited the transform, saved, recompiled, ran this, (and this I cut and pasted from my transform)
OConv(IConv(Input.TRANS_DT, 'D/MDY[2,2,2]'), 'D-DMY[2,A3,4]')
and got the following error....
V2ARCDC_1..DATACONV: At row 1, link "Output", while processing column "TRANS_DT"
Value treated as NULL
Attempt to convert String value "05-Mar-2004" to Date type unsuccessful
No rows were copied to the database.
Yet, when I re-edited to
OConv(IConv(Input.TRANS_DT, 'd/mdY[2,2,2]'), 'd-mdY[2,A3,4]')
(also a cut and paste)
then saved, compiled and reran it, the results were that at least rows were copied to the database, but still with no leading zeros...
I am totally befuddled...I even tried this twice...same results....works in lower case, but not upper case., but still no leading zeros
thoughts ?
OConv(IConv(YourDate, 'D/MDY[2,2,4]'), 'D-DMY[2,A3,4]')
(for a 4 digit year part as given in the example)[/quote]
How very odd !
javascript:emoticon(':?')
Confused
I edited the transform, saved, recompiled, ran this, (and this I cut and pasted from my transform)
OConv(IConv(Input.TRANS_DT, 'D/MDY[2,2,2]'), 'D-DMY[2,A3,4]')
and got the following error....
V2ARCDC_1..DATACONV: At row 1, link "Output", while processing column "TRANS_DT"
Value treated as NULL
Attempt to convert String value "05-Mar-2004" to Date type unsuccessful
No rows were copied to the database.
Yet, when I re-edited to
OConv(IConv(Input.TRANS_DT, 'd/mdY[2,2,2]'), 'd-mdY[2,A3,4]')
(also a cut and paste)
then saved, compiled and reran it, the results were that at least rows were copied to the database, but still with no leading zeros...
I am totally befuddled...I even tried this twice...same results....works in lower case, but not upper case., but still no leading zeros
thoughts ?
Hi,
Here is ConvertDate routine.
If Arg1 = @null
then Ans = @null
Else
Ans = Oconv(Iconv(Arg1, "d/mdy" ), "d-dmy[2,a3,4]")
End
----
I wrote this routine. I reads input from seq file and writes to Oracle table. The target column in Oracle table is defined as Type Date.
In the transformer, I use ConvertDate(InTrans.Date_of_Injury)
In input seq file Date_of_Injury is defined as char and in Target is defined as varchar
Ketfos
Here is ConvertDate routine.
If Arg1 = @null
then Ans = @null
Else
Ans = Oconv(Iconv(Arg1, "d/mdy" ), "d-dmy[2,a3,4]")
End
----
I wrote this routine. I reads input from seq file and writes to Oracle table. The target column in Oracle table is defined as Type Date.
In the transformer, I use ConvertDate(InTrans.Date_of_Injury)
In input seq file Date_of_Injury is defined as char and in Target is defined as varchar
Ketfos
-
- Participant
- Posts: 6
- Joined: Mon Dec 27, 2004 3:32 pm