How to handle null values in db2
Answers were Sorted based on User's Feedback
Answer / lu
you need to declare binary indicator variable....
10 Ind-variable pic s(904) comp.
| Is This Answer Correct ? | 10 Yes | 3 No |
Answer / biswamoy majumder
To insert a NULL, move -1 to the null indicator, To insert
a valid value, move 0 to the null indicator.
declare separately Null indictor variable in Working-
Storage section.
10 variable-NI pic s9(04) Usage comp.
| Is This Answer Correct ? | 5 Yes | 0 No |
Answer / yuvaevergreen
IN DCLGEN,
>>"INDICATOR VARS .. ===> NO" indicates the presence of
null variables for the fields in the tables.
>>indicator variable should be declared of type s9(4) comp.
77 DAY-IND PIC S9(4) BINARY.
Move -1 to the indicator variable and use in sql.
exec sql
insert into employee(name)
values(:ws-name:ws-name-ind)
end-exec;
ws-name-ind is the indicator variable which inserts null in
the field ws-name.
| Is This Answer Correct ? | 3 Yes | 0 No |
Answer / ankitha
you can use value function or null indicators if you want to
handle nulls in program.
| Is This Answer Correct ? | 4 Yes | 2 No |
What is referential integrity?
How can you split a table in to exactly half?
How do you prepare a COBOL + DB2 program from coading till execution ?
How to connect to db2 database from windows command line?
where can we use index and subscript ? with example ?
What will the DB2 optimizer do?
How to design maps
Assuming that a site's standard is that pgm name = plan name, what is the easiest way to find out which Will precompile of an DB2-COBOL program bomb, if DB2 is down?
what's the error code for Unique Index Violation?
I have a main program (A) where we delete some rows in table in a cursor, and we commit it in sub program(B). What will happen - will we get an error or not?
difference between group clause and order clause
How do you declare a host variable (in COBOL) for an attribute named emp-name of type VARCHAR(25) ?