title: Populate Date Dimension Table and Determine Day Type via PL/SQL
body: <p>I have the following SQL Table:</p>
  
  <pre><code>CREATE TABLE SALES
  (saleID         INT     PRIMARY KEY,
  grossSalePrice      DECIMAL(9,2),
  vehicleStatus       VARCHAR(10) NOT NULL CHECK (lower(vehicleStatus) IN ('available', 'sold', 'pending')),
  saleDate        DATE,
  saleMileage     INT,
  customerID      INT,
  salespersonID       INT,
  vehicleVIN      VARCHAR(25),
  CONSTRAINT SALES_FK1 FOREIGN KEY (customerID) REFERENCES CUSTOMERS(customerID),
  CONSTRAINT SALES_FK2 FOREIGN KEY (vehicleVIN) REFERENCES VEHICLES(vehicleVIN),
  CONSTRAINT SALES_FK3 FOREIGN KEY (salespersonID) REFERENCES SALESPERSONS(salespersonID));
  </code></pre>
  
  <p>AND I've created the following Star-Schema Dimension Table:</p>
  
  <pre><code>CREATE TABLE TIMES
  (saleDay        DATE        PRIMARY KEY,
  dayType         VARCHAR(50) NOT NULL);
  </code></pre>
  
  <p>I need to populate the <code>saleDay</code> column of the <code>TIMES</code> table with each <code>saleDate</code> within the <code>SALES</code> table. Also, the <code>dayType</code> column should be completed based on each <code>saleDay</code>. The values for the <code>dayType</code> column should be <code>Weekday</code>, <code>Weekend</code>, or <code>Holiday</code> and if the dayType is <code>Holiday</code> it should trump <code>Weekend</code> or <code>Weekday</code>. </p>
  
  <p>To qualify for being a <code>Holiday</code>, the dates would have to be:
  January 1,
  January 15,
  January 19,
  May 28,
  July 4,
  October 8,
  November 11,
  November 22,
  December 25.</p>
  
  <p>I've been asked to populate the <code>saleDay</code> and <code>dayType</code> values via PL/SQL but I have NO Idea where to start or how to accomplish this. Any help/guidance as to how I can complete this is greatly appreciated. </p>