How to resolve the -305 error code in DB2?
And also please let me know, how to resolve the db2 error
codes.
Answer Posted / daphne
Before going to the solution, here is the explanation of a
null indicator.
In DB2, a NULL is stored using a special one-byte null
indicator which is attached to every NULLABLE column. If
the column is defined as NULL, then the indicator field is
used to record this. The indicator variable is transparent
to an end user, but must be provided for when programming
in a host language.
A positive value or a value of 0 means the column is not
null and any actual value stored in the column is valid. A
negative value indicates that the column is set to null. If
the value is -2 then the column was set to null as the
result of a data conversion error. The default is null.
There are two reasons for getting -305.
1) As said in the first answer if the table column is
defined as NOT NULL (with no default) and if we try to
insert a null value we get that.
- This should be resolved by making sure the inserted
value is not null. Null indicator cannot be used here since
the column is defined as NOT NULL.
2) A table column is defined as NULL:
The host variable has a not null value. The Null
indicator is not set in the host program, so the null
indicator is defaulted to a negative value.
- This should be resolved by using a null indicator in
the host program and moving the relevant value to the null
indicator.
| Is This Answer Correct ? | 56 Yes | 5 No |
Post New Answer View All Answers
How many types of page locks can be held in db2?
what is the responsibility of the construction superintendent
Can we update view in db2?
How and when does the db2 enforces the unique key?
What does sqlcabc has?
What is db2 stogroup?
What is the maximum size of varchar data type in db2?
What is a collection in db2?
What is a Foreign Key?
Is db2 free?
What is meant by dclgen?
How would the varchar column remarks defined?
What are the uses of db2 optimizer?
What is difference between isnull and coalesce?
What is the max length of sqlca?