title: ORACLE - Cannot insert a NULL value to a NON-Primary Key
body: <p>I Have searched the web and various forums but I cannot figure out why this won't work. My Database is made up from the following Tables:</p>
  
  <pre><code>CREATE TABLE CUSTOMER(
  custid Number(4),
  cfirstname varchar2(30),
  csurname varchar2(20) NOT NULL, 
  billingaddr varchar2(30), 
  cgender varchar2(1),
  CONSTRAINT custpk PRIMARY KEY (custid),
  CONSTRAINT genderconst CHECK(cgender in ('M','F','m','f'))
  );
  
  CREATE TABLE PRODUCT(
  prodid Number(4),
  prodname varchar2(30),
  currentprice Number(6,2),
  CONSTRAINT cprice_chk CHECK(currentprice &gt;= 0 AND currentprice &lt;=5000 ),
  CONSTRAINT prodpk PRIMARY KEY (prodid),
  CONSTRAINT pricepos CHECK((currentprice &gt;= 0))
  );
  
  CREATE TABLE SALESPERSON(
  spid Number(4),
  spfirstname varchar2(30),
  spsurname varchar2(30),
  spgender varchar2(1),
  CONSTRAINT salespk PRIMARY KEY (spid)
  );
  
  CREATE TABLE SHOPORDER(
  ordid Number(4),
  deliveryaddress varchar2(30),
  custid Number(4) NOT NULL,
  spid Number(4) NOT NULL,
  CONSTRAINT orderpk PRIMARY KEY (ordid),
  CONSTRAINT orderfk1 FOREIGN KEY (custid) REFERENCES CUSTOMER(custid),
  CONSTRAINT orderfk2 FOREIGN KEY (spid) REFERENCES SALESPERSON(spid)
  );
  
  CREATE TABLE ORDERLINE(
  qtysold Number(4),
  qtydelivered Number(4),
  saleprice Number (6,2),
  ordid Number(4) NOT NULL,
  prodid Number(4) NOT NULL,
  CONSTRAINT qty_chk CHECK (qtydelivered &gt;= 0 AND qtydelivered &lt;=99),
  CONSTRAINT price_chk CHECK(saleprice &gt;= 0 AND saleprice &lt;=5000 ),
  CONSTRAINT linefk1 FOREIGN KEY (ordid) REFERENCES SHOPORDER(ordid),
  CONSTRAINT linefk2 FOREIGN KEY (prodid) REFERENCES PRODUCT(prodid)
  );
  </code></pre>
  
  <p>And I am using an insert statement to insert the following:</p>
  
  <pre><code>INSERT INTO SHOPORDER(ordid, deliveryaddress, spid)
  VALUES (41, NULL, 23);
  </code></pre>
  
  <p>Whether I use '' or NULL it gives me the error:</p>
  
  <p>ORA-01400: cannot insert NULL into ("S9710647"."SHOPORDER"."CUSTID");</p>
  
  <p>My issue that I have not set deliveryaddress as a Primary key nor is it a Foreign key or contain any NOT NULL CoNSTRAINTS.</p>
  
  <p>Is there a factor that I am missing here? The majority of forums have had people with problems relating to constraints. I cannot see any conflicting constraints.</p>
  
  <p>Cheers</p>