Skip to content

Instantly share code, notes, and snippets.

@robneville73
Created October 4, 2017 17:59
Show Gist options
  • Save robneville73/08d5dd45e81aeb2387108b8258d142f3 to your computer and use it in GitHub Desktop.
Save robneville73/08d5dd45e81aeb2387108b8258d142f3 to your computer and use it in GitHub Desktop.
DO $$
DECLARE
d1 pickupcapacities.deliverydate%TYPE;
d2 pickupcapacities.deliverydate%TYPE;
day pickupcapacities.dayofweek%TYPE;
BEGIN
d1 := '11-05-2017';
d2 := '12-31-2017';
LOOP
day := substring(to_char(d1, 'day') from 1 for 3);
INSERT INTO pickupcapacities (zoneid, deliverydate, capacity, filled, resetdate, dayofweek)
VALUES ('CPU', d1, 5000, 0, current_date, day);
d1 := d1 + 1;
EXIT WHEN d1 > d2;
END LOOP;
END$$;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment