How to insert spaces in a time datatype filed



IBM's flagship relational database management system

How to insert spaces in a time datatype filed

Postby chandra 2185 » Mon Jul 23, 2012 7:43 am

Hi,

I am inserting data into db2 table from a cobol program which reads a sequential file and loads data into db2 table. I have spaces in the data to be inserted into a time datatype column in the db2 table. so when i am trying to insert it is giving me an error. how can I handle this. your help is highly appreciated.

-Thanks.
chandra 2185
 
Posts: 17
Joined: Mon Jun 18, 2012 2:30 am
Has thanked: 0 time
Been thanked: 0 time

Re: How to insert spaces in a time datatype filed

Postby dick scherrer » Mon Jul 23, 2012 8:37 am

Hello,

You will need to change the definition of the column(s) to char or ensure there is a valid date in the input data.

I suggest you correct the data so there will not be forever fiddling with a char field that should be a date.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: How to insert spaces in a time datatype filed

Postby GuyC » Mon Jul 23, 2012 12:12 pm

you could use NULLIF if the column is nullable.
I can explain it to you, but i can not understand it for you.
GuyC
 
Posts: 315
Joined: Tue Aug 11, 2009 3:23 pm
Has thanked: 1 time
Been thanked: 4 times

Re: How to insert spaces in a time datatype filed

Postby NicC » Mon Jul 23, 2012 12:28 pm

Or get clarification from the writer of the program specifications as to what to do when no date/time is available or is in the wrong format.
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 3025
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisies (almost)
Has thanked: 4 times
Been thanked: 136 times


Return to DB2

 


  • Related topics
    Replies
    Views
    Last post