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 ?    55 Yes 5 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Mention the definition of cobol in varchar field.

706


Is the primary key a clustered index?

627


Can we update view in db2?

568


What is ibm db2 database?

554


What is db2? Explain.

613






What is db2?

753


in my project..TEST is db2 8.1 version In PROD it is 7.1 if i do REORG in TEST.. can I use the same REORG jcl with out modification in PROD region (this is DB2 8.1 )? if not, what modification i need to do in my REORG control card?

1639


What is buffer pool?

629


What is a Foreign Key?

670


What is package in db2 mainframe?

570


Mention a credible reason why select* is never given preference in an sql program that has been embedded.

733


What is database manager in db2?

563


can all users have the privilage to use the sql statement select * (dml)?

652


When do you specify the isolation level?

623


What are the benefits of using the db2 database?

672