CREATE TABLE airplanes (
program_id     VARCHAR2(3),
line_number    NUMBER(10),
customer_id    VARCHAR2(4),
order_date     DATE,
delivered_date DATE)
PCTFREE 0
PCTUSED 99;

ALTER TABLE airplanes
ADD CONSTRAINT pk_airplanes
PRIMARY KEY (program_id, line_number)
USING INDEX;

DECLARE
 progid  VARCHAR2(3) := '000';
 lineno  NUMBER(10) := 0;
 custid  VARCHAR2(4) := 'AAL';
 orddate DATE;
 deldate DATE;
BEGIN
  LOOP
    SELECT DECODE(progid,'000','737','737','747','747','757','757','767','767','777','777','999')
    INTO progid
    FROM dual;

    IF progid = 999 THEN
      EXIT;
    END IF;

    FOR x IN 1..50000
    LOOP
      lineno := lineno + 1;

      SELECT DECODE(custid,'AAL','DAL','DAL','SAL','SAL','ILC','ILC','SWA','SWA','NWO','NWO','USAF','USAF','AAL')
      INTO custid
      FROM dual;

      OrdDate := SYSDATE + lineno;
      DelDate := OrdDate + lineno + 100;

      INSERT INTO airplanes
      (program_id, line_number, customer_id,
      order_date, delivered_date)
      VALUES
      (progid, lineno, custid, orddate, deldate);
    END LOOP;
    lineno := 0;
  END LOOP;
  COMMIT;
END load_airplanes;
/
