How to resolve the -305 error code in DB2?
And also please let me know, how to resolve the db2 error
codes.
Answer Posted / s
If a column contains nulls and you dont include a null
indicator variable in the program, the program receives a
-305 SQLCODE.
Even if no columns allow for nulls, it may be necessary to
use the null indicator to avoid a -305 SQLCODE. For eg, if
AVG(SAL) is computed and ther eare no employees in the
department, the result is null and a null indicator must be
ccoded on the SQL statement to avoid -305.
EXEC SQL SELECT SNAME
INTO :SNAME:SNAME-INDNULL
FROM S
WHERE SN = :SN-IN
END-EXEC
If SNAME has a value, SNAME-INDNULL contains 0.
If SNAME is NULL, SNAME-INDNULL contains -2.
Similarly, Inserting a NULL also required special handling.
If you are not providing a value for SNAME, a -1 can be
moved to the null indicator associated with the SNAME
column:
MOVE -1 to SNAME-INDNULL
EXEC SQL INSERT INTO S
(SN,SNAME,STATUS,CITY) VALUE
(:SN,:SNAME:SNAME-INDNULL,:STATUS,:CITY)
END-EXEC
| Is This Answer Correct ? | 23 Yes | 3 No |
Post New Answer View All Answers
Mention the definition of cobol in varchar field.
Explain packages.
How do I optimize a query in db2?
What happens in bind step in a db2 program?
i tried to copy some records from microsoft excel to as-400 physical file through "Bosanova" emulation. Out of 14000 records only 12000 records copies and subsequently programe started to hang. Then, i closed the program forcefully. I did' under stand the problem. Also when i try to compile the physical file it is showing as "The file in use". How to overcome this problem?
What are catalog tables in db2?
Mention the way of highlighting as well as putting a cursor to use in a cobol program.
What is a page in db2?
What is the physical storage length of date data type?
What is dbrm in db2 database?
Highlight all the advantages that are attached to a package.
What is db2 and what is the use of db2 optimizer?
what are bind concepts in db2 cobol?
What is a buffer in memory?
How can you classify the locks in db2?