View previous topic :: View next topic
|
Author |
Message |
candyboy
New User
Joined: 13 Nov 2006 Posts: 10
|
|
|
|
Hi,
I have a field defined as X(10) in which i normally store a date like '2009-01-01'. This field corresponds to a DATE (DB2 datatype DATE) field in DB2 table. I basically load my X(10) field to this DATE field in DB2.
I have a requirement now to load NULLS to this date field in DB2. Could you let me know what should I move in the X(10) field to achieve nulls in the date field on table. Or if there is some other way to do it....let me know.
Thanks!!
CB |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
If there is still time, i would suggest that you not use NULL. . . It may well be that others in your organization are not familiar with NULL also.
There is no actual "null" value - NULL is the absence of any value. When using NULL, a column needs 2 host variable entries - one for the actual value of the data and the other to indicate whether there is a value or not. This is known as the NULL indicator.
Suggest you talk with your dba for some samples of other tables/columns that are defined as NULLable and the code used to select/insert/update them if NULL must be used. |
|
Back to top |
|
|
Gnanas N
Active Member
Joined: 06 Sep 2007 Posts: 792 Location: Chennai, India
|
|
|
|
Hi,
Will these work?
1. Just omit date field while inserting...
2. Use NULL while inserting...
Sorry, I'm not sure if this suits for your requirement. |
|
Back to top |
|
|
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
|
|
|
|
Is the column in the DB2 table defined as nullable. If it is then just set the null indicator to -1 when you do an insert. |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
candyboy,
Do you use some LOAD utility to achieve this?
I believe the BMC LOADPLUS has some option to load the column as NULL if the value in the file equals ' '(space) or some constant. |
|
Back to top |
|
|
candyboy
New User
Joined: 13 Nov 2006 Posts: 10
|
|
|
|
Hi All,
Yes the field is defined as nullable in the table and under normal circumstances, the null indicator is used with value -1 while writing the field to table. This is when we use proper modules & view handlers.
But currently we are loading table using a load file. We are using DSNUTILB for loading.
The issue we have rite now is:
I have a table with fields say A,B,C &D where C being the nullable Date field.
To load this table we are creating a load file with fields A,B,C & D.
Now if I accomodate a Null indicator in my load file (A,B,C,C-NI,D) , the length of my load file increases and this pushes the remaining fields further causing load to fail.
Thanks
CB |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
have you thought of modifiying the mask definition to accomodate the extra length in the input record length? |
|
Back to top |
|
|
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
|
|
|
|
Put the null indicator after the last field or use the first byte of the date field to indicate that it should be null. Or change your load control cards which you would have to do anyways! |
|
Back to top |
|
|
|