in reply to Re^3: Multiple queries on DBI corresponding to multiple csv files?
in thread Multiple queries on DBI corresponding to multiple csv files?
I suggest you add another 'type' field to run the non-select query with $dbh->do($sql). However you probably only need run that query once not for each id.
pojfor my $id (@id){ my @query = ( [1,"DECLARE GLOBAL TEMPORARY TABLE SESSION.temp SELECT name,id FROM mytable ON COMMIT PRESERVE ROWS WITH NORECOVERY"], [2,"SELECT name FROM SESSION.temp WHERE id=? AND salary >= 1","csvfile2_$id.csv"], [2,"SELECT id FROM mytable WHERE id=? AND salary >= 1","csvfile1_$id.csv"], ); for (@query){ my ($type,$sql,$filename) = @$_; if ($type == 1){ $dbh->do($sql); } elsif ($type == 2){ run_query($sql,$filename,$id); } } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: Multiple queries on DBI corresponding to multiple csv files?
by jtech (Sexton) on Feb 25, 2019 at 10:08 UTC | |
by poj (Abbot) on Feb 25, 2019 at 12:52 UTC |