It's difficult to comment without seeing the actual program implementations.
If the only thing that changed is the addition of indicator variables in the SELECT statement, and it worked before, that means that no NULLs were present in the database in Col_4 or Col_5 before that time. (At least, not in rows being accessed by that program.)
My first guess would be the following:
- the program logic inspects Col_4; seeing a blank, some sensible thing is done (e.g., using an INSERT without an explicit Column_4).
- now, because of your second change, NULLs are being put in the database instead of the default (which is "current timestamp").
- that program logic is now receiving a NULL but does not expect it, i.e., "forgets" to inspect the indicator variable.
- since the content of the :var4 host variable might be anything when :null-ind-A is negative, this could indeed be an invalid timestamp
- the program logic then goes to the wrong branch and tries to insert that invalid timestamp ==> SQLCODE -180.
Solution: need to change all "var4 is spaces" tests to "null-ind-A is negative".
Simpler solution, at least if my analysis is correct: change
Code:
Select Col_1, Col_2, Col_3, Col_4, Col_5
Into :var1, :var2, :var3, :var4 :null-ind-A, :var5 :null-ind-B
into
Code:
Select Col_1, Col_2, Col_3,
COALESCE(CAST(Col_4 AS char(24)), ''), COALESCE(Col_5,'')
Into :var1, :var2, :var3, :var4, :var5
and the program can continue checking for blanks instead of for NULLs...