-- place_order.sql

DECLARE
  xmas_day order_header.order_date%TYPE;
  next_invoice order_header.invoice_number%TYPE;
BEGIN
  xmas_day := TO_DATE('December 25, 2006', 'Month DD, YYYY');

  SELECT MAX(invoice_number)
    INTO next_invoice
    FROM order_header;

  next_invoice := next_invoice + 1;

  INSERT INTO order_header (invoice_number, store_number, 
     customer_id, order_date, amount_due)
  VALUES (next_invoice, 7, 7881, xmas_day, 0);

  INSERT INTO order_item (invoice_number, product_id,
     quantity, discount)
  VALUES (next_invoice, 'CHYE0000015', 10, 0.1);
END;
/
