IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Char to Date Convertion


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Ganesh K Rajan

New User


Joined: 13 May 2005
Posts: 7

PostPosted: Thu May 26, 2005 3:25 pm
Reply with quote

Hi,
I wanted to convert date declared as char(7)(in CYYMMDD) to date format (YYYYMMDD).
I used the following query :

SELECT DISTINCT POLICY_NO,TRANS_DTE, TO_DATE((SUBSTR(TRANS_DTE,2,6)),''YYYYMMDD'') FROM DB2PADM using TO_DATE function but it gives following error.

SQLCODE = -171,
ERROR: THE DATA TYPE, LENGTH, OR VALUE OF ARGUMENT 2 OF TO_DATE IS INVALID
Can anyone suggest any other way.

Rgs,
Ganesh.
Back to top
View user's profile Send private message
prasannanjaneya
Warnings : 1

New User


Joined: 14 Mar 2005
Posts: 10
Location: pune

PostPosted: Thu May 26, 2005 5:07 pm
Reply with quote

hi,

i have a doubt. in char(7) c stands for what.
Back to top
View user's profile Send private message
prasannanjaneya
Warnings : 1

New User


Joined: 14 Mar 2005
Posts: 10
Location: pune

PostPosted: Thu May 26, 2005 5:57 pm
Reply with quote

HI,

I THINK TO_DATE RETURNS ONLY TIME-STAMP VALUE. U HAD GIVEN A VALUE WHICH IS NOT IN TIMESTAMP FORMAT. PLEASE THINK IN THIS WAY I HOPE U WILL GET SOLUTION FOR UR ERROR.


IF ANY BODY FEEL THIS IS WRONG PLEASE EXPLAIN THE CORRECT ONE TO ME.

THANKS,
PRASANNA.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts Replacing 'YYMMDD' with date, varying... SYNCSORT 3
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts Need to convert date format DFSORT/ICETOOL 20
No new posts Exclude rows with > than x occurre... DFSORT/ICETOOL 6
Search our Forums:

Back to Top