My 2nd question really was 'How far into the future do you want the dates in the mysql table to go '.
It could get more complicated if you want to detect changes to the 2 oracle tables. Assuming the record count is in the hundreds, it might be simpler just to delete all future records and regenerate the table each night.
As a starter idea, here is a test script that generates the records you would need to insert.
poj#!perl use strict; use DBI; use Time::Piece; use Time::Seconds; my %regular = ( Mon => ['08:00','17:00'], Tue => ['08:00','17:00'], Wed => ['08:00','17:00'], Thu => ['08:00','17:00'], Fri => ['08:00','17:00'], Sat => ['08:00','12:00'], Sun => ['00:00','00:00'], ); my %except = ( '2016-05-30' => ['00:00','00:00'], '2016-07-04' => ['00:00','00:00'], '2016-09-05' => ['00:00','00:00'], '2016-10-10' => ['00:00','00:00'], '2016-11-08' => ['00:00','00:00'], '2016-11-11' => ['00:00','00:00'], '2016-11-24' => ['00:00','00:00'], '2016-12-26' => ['00:00','00:00'], ); my $t = localtime; my $end_date = '2016-12-31'; open OUT,'>','all_dates.csv' or die "$!"; my $id = 1; while ($t->ymd le $end_date){ my $ymd = $t->ymd; my $w = $t->wdayname; my $open = $except{$ymd}[0] || $regular{$w}[0]; my $close = $except{$ymd}[1] || $regular{$w}[1]; my $is_closed = ($open eq '00:00') ? 1 : 0; print OUT "$id,$ymd,$w,$open,$close,$is_closed\n"; $t += ONE_DAY; ++$id; } close OUT;
In reply to Re^3: Pull data from two tables, insert into new table?
by poj
in thread Pull data from two tables, insert into new table?
by Hans Castorp
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |