
// CF 7-4

// Positions table

CREATE TABLE Positions (
                        PCN             integer,
                        JobTitleCode1   integer,
                        StartDate       date,
                        EndDate         date,
                        PRIMARY KEY (PCN)
                       );

// Actual insert

INSERT INTO Positions
  SELECT 341288,
         NULL,
         DATE '12/05/1997',
         DATE '01/01/3000'
    FROM Positions
   WHERE NOT EXISTS (SELECT *
                       FROM Positions AS P2
                      WHERE P2.PCN = 341288
                        AND P2.EndDate = DATE '01/01/3000');

