View previous topic :: View next topic |
Author |
Message |
maverick05 Beginner

Joined: 15 May 2005 Posts: 72 Topics: 24
|
Posted: Wed May 28, 2008 12:43 am Post subject: Query regarding relation between Hex and a Null value |
|
|
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 |
|
 |
CraigG Intermediate
Joined: 02 May 2007 Posts: 202 Topics: 0 Location: Viginia, USA
|
Posted: Wed May 28, 2008 6:23 am Post subject: |
|
|
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 |
|
 |
jsharon1248 Intermediate
Joined: 08 Aug 2007 Posts: 291 Topics: 2 Location: Chicago
|
Posted: Wed May 28, 2008 8:33 am Post subject: |
|
|
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 |
|
 |
|
|