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


Please Help Members By Posting Answers For Below Questions

What is temporal table in db2?

842


What is a page in db2?

828


While unloading huge amount of data from table. Suddenly job failed some error. Imagine 1M data unloading, In that 90% data unloaded only 10% left, So if want to unload the rest 10% what needs to be done? Whether do i need to start from top or anything ?

2119


Can you tell me how can you find out the # of rows updated after an update statement?

911


what is the role of the cursor in db2?

844


What are the two types of logging in the db2 database? Explain them.

833


How can record locking be achieved in those DB2 versions which do not support it?

865


What is sqlca’s maximum length?

929


If the cursor is kept open followed the issuing of commit, what is the procedure to leave the cursor that way?

925


How would you find out the total number of rows in a db2 table?

812


What is the syntax for FETCH in DB2 ?

956


What is runstats and reorg in db2?

1047


What is the maximum length of sqlca?

1180


Which component is used to execute the sql statements?

880


What is db2 bind?

843