title: SQL/Oracle - "Cannot insert null into primary key"
body: <p>So, I have an Oracle database (in APEX) in which I have a column called "Scheme".</p>
  
  <p>Like seen below:</p>
  
  <pre><code>CREATE TABLE Scheme
    (
  Scheme_ID    NUMBER NOT Null,
  description VARCHAR2 (800) ,
  price FLOAT (3) ,
  amount_sold     INTEGER ,
  Personal_Trainer_ID NUMBER NOT NULL
  ) ;
  ALTER TABLE Schema ADD CONSTRAINT Schema_PK PRIMARY KEY ( Schema_ID ) ;
  </code></pre>
  
  <p>Now, all my tables are set-up like this and perfectly working, but when I try an insert on my Scheme, it says I'm trying to insert null into the primary key scheme_ID.</p>
  
  <p>I'll show you 2 SQL inserts I use. One for a personal_trainer, and one for the Scheme.</p>
  
  <pre><code>INSERT INTO Personal_Trainer (name, loginname, date_of_birth, password)
  VALUES('Bojan', 'Bojan', '15-07-1974','fitline');
  </code></pre>
  
  <p>Peronal_Trainer has a Personal_Trainer_ID as primary key, exactly set-up like the Scheme. Inserting this command works perfectly fine.</p>
  
  <pre><code>insert into schema (description, price, amount_sold, Personal_Trainer_ID)
  values ('3x pushups, 5x bench, 7x squats - 15kg',200, 1, 2);
  </code></pre>
  
  <p>Now, when I try to insert this command I get this error message:</p>
  
  <p>ORA-01400: cannot insert NULL into ("SCHEME"."SCHEME_ID")</p>
  
  <p>****************************EDIT*****************************************</p>
  
  <pre><code>CREATE TABLE Personal_Trainer
  (
  Personal_Trainer_ID NUMBER  NOT NULL,
  name                VARCHAR2 (35) ,
  date_of_birth       DATE ,
  loginname           VARCHAR2 (35) ,
  password            VARCHAR2 (35)
  ) ;
  ALTER TABLE Personal_Trainer ADD CONSTRAINT Personal_Trainer_PK PRIMARY KEY     ( Personal_Trainer_ID ) ;
  </code></pre>
  
  <p>This is my table of Personal Trainer.</p>