Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CANNOT INSERT NULL INTO

Status
Not open for further replies.

z96andh

Programmer
Oct 1, 2001
14
0
0
SE
Hey everyone!

I've come up with a very strange error... I have a COBOL program running on a NT server. In this program I insert values into a column. This weekend we added 8 column to this table and to my surprise the INSERT INTO didn't work properly. In one variable is 7 spaces (hex-code 20) and when I try to insert I get the error message: CANNOT INSERT NULL INTO pointing at this variable. Then I removed the 8 columns I added and to my surprise the program worked again... as nothing had happened.

Please help me!!!

Best regards
/Anders
 

You must have added 8 NOT NULL columns. Meaning, there is a 'required' constraint created for this columns.

When you try to run your original program, the added cols are not included in the insert statement defaulting NULL values to be assigned on the new columns, thereby triggering a NOT NULL exception.

Describe your table to see if the columns are nullable. By the way, how did you add these 8 columns?
 
If some of your new columns are mandatory (not null) you have to provide some default values to mandatory columns not listed in the insert statement and not empty values to those listed.
 
The 8 columns are NOT not null :)...
 
Do Oracle 8.1.6 truncate strings containing space (hex 20)?

In that case maybe the variable containing ' ' is truncated to a NULL value...
 
It seems like I have problem with my COBOl environment. When I try with a old program then it doesn't work with the 8 columns deleted. But a old compiled program can still run OK...

Seems like I have to find the error in Net Express (COBOL environment).

Thanks anyway

//Anders
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top