MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Query regarding relation between Hex and a Null value

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database
View previous topic :: View next topic  
Author Message
maverick05
Beginner


Joined: 15 May 2005
Posts: 72
Topics: 24

PostPosted: Wed May 28, 2008 12:43 am    Post subject: Query regarding relation between Hex and a Null value Reply with quote

Hi,

Can someone please clarify the followin queries?

1. How do i manually insert Null in a nullable column in DB2 table?
A Nullable comun doesn't have a Hex value.I can't put spaces since it takes 4 0 as Hex value.For remaining Nullable columns it displays as '-' with no hex values.But again - has got 6 0 as it hex value

2.I have defined a column as not nullable with default value as 'Y'.
In my cobol Db2 pgm,if i dont either insert a value in thsi column or never use this column in SQL insert statement,wont the table will be inserted with the value 'Y' automatically ?
Does it insert Space instead?
Back to top
View user's profile Send private message
CraigG
Intermediate


Joined: 02 May 2007
Posts: 202
Topics: 0
Location: Viginia, USA

PostPosted: Wed May 28, 2008 6:23 am    Post subject: Reply with quote

1. SET NULLABLE_COL = NULL

2. If the default is Y and you don't provide anyother value then it will default to Y.
Back to top
View user's profile Send private message
jsharon1248
Intermediate


Joined: 08 Aug 2007
Posts: 291
Topics: 2
Location: Chicago

PostPosted: Wed May 28, 2008 8:33 am    Post subject: Reply with quote

If you're issuing an INSERT statement, just don't list the column, and DB2 will set the column to null. Some tools like SPUFI will display '-' characters when a column is null which sounds like it may be the source of your confusion. One way to make sure a column is null is to code a SELECT with a COALESCE function,

Code:
SELECT  COALESCE(COLA,'COLA is null')
  FROM  <table>
 WHERE <identify row>



An alternate method to set a column to null in an INSERT issued from a COBOL program is to set the null indicator variable to -1.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group