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

NOt able to pass NUll values to a date field


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

New User


Joined: 24 Nov 2005
Posts: 49
Location: chennai

PostPosted: Thu Aug 02, 2012 12:18 pm
Reply with quote

I am trying to insert the null values into a date field but the current date is getting populated in to the date filed in the table.

Please advise

thanks,
akash
Back to top
View user's profile Send private message
xknight

Active User


Joined: 22 Jan 2008
Posts: 117
Location: Liberty city

PostPosted: Thu Aug 02, 2012 12:29 pm
Reply with quote

Hello,

Quote:
I am trying to insert the null values into a date field but the current date is getting populated in to the date filed in the table.


Ensure the field is nullable and try using the null indicator to -1.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Thu Aug 02, 2012 12:42 pm
Reply with quote

akashs wrote:
Please advise


how about you advising us:

what is the ddl for the column in question?

what is the sql that you used
and the pic clauses of any host-variables that you used?

without the above information,
no one can give you an adequate and informed answer,
and teach you what you need to learn
or point you in the right direction in the manuals.
Back to top
View user's profile Send private message
akashs

New User


Joined: 24 Nov 2005
Posts: 49
Location: chennai

PostPosted: Thu Aug 02, 2012 2:16 pm
Reply with quote

IN the table the field INT_DATE is declared as date and in the dclgen it's declaration is :INT-DATE is PIC x(10). For passing null to that date field in the program i have used null indicator but current date is getting populated during the insertion of that field into the table .
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Thu Aug 02, 2012 2:24 pm
Reply with quote

let me rephrase my earlier requirements for information:

cut and paste the line describing the column from the DECLARE table statement.

cut and paste the SQL that you are using.

cut and paste the element definitions (to include pic clause)
of all host variables used in the problem SQL.

in order to keep this thread short, two assumptions:
1. your column definition in the DECLARE table statement includes the verbiage:
NOT NULL WITH DEFAULT

2. There is an INSERT TRIGGER associated with the table.

my guess is 1.
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2481
Location: Netherlands, Amstelveen

PostPosted: Thu Aug 02, 2012 2:43 pm
Reply with quote

Quote:

cut and paste


Well Dick, that will leave the TS with no source in the end.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Thu Aug 02, 2012 2:46 pm
Reply with quote

while we are waiting for you to decide if we actually need the info requested,
in order to provide assistance,
i will take advantage of a teaching moment that has arisen, yet again.

Please read Using Nulls in DB2
it is an informative article and explains why you can not pass null values to a column:
because there is no such thing as null value(s).

PeterHolland wrote:
Well Dick, that will leave the TS with no source in the end


based on what we know of the TS so far,
why is that a bad thing?
Back to top
View user's profile Send private message
seagull

New User


Joined: 28 May 2007
Posts: 24
Location: Dublin

PostPosted: Thu Aug 02, 2012 6:55 pm
Reply with quote

What product are you using to view your table? We have platinum, and it displays null dates as current date, but with N in the null indicator field.
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 INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts Need to convert date format DFSORT/ICETOOL 20
Search our Forums:

Back to Top