midlandmonkey has asked for the wisdom of the Perl Monks concerning the following question:
Gareth
I have posted my sub routine below:
sub create_temp_tables($$) { # Create copies of sp047 and sp057 for updating my ($dbh, $dbms) = (@_); my $sql; if ($dbms eq 'ORACLE') { $sql = q{create table sp047_postcodes_temp as select * +from sp047_postcodes}; $sql = q{create table sp057_regions_temp as select * fr +om sp057_regions}; } else # SQLServer { $sql = q{select * into sp047_postcodes_temp from sp047_ +postcodes}; $sql = q{select * into sp057_regions_temp from sp057_re +gions}; } $sth = $dbh->prepare($sql); if ($sth) { my $rc = $sth->execute(); if ($sth->err) { myexit($sth->errstr, $dbh); } else { # Need to commit to release locks in SQL Server - we have +done nothing else at this stage, # so no problem with this. $dbh->commit; } $sth->finish; } else { myexit("Unable to prepare SQL : " . $sql . "\n", $dbh); } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: New to Perl. How to loop!
by kennethk (Abbot) on Nov 25, 2009 at 15:29 UTC | |
by midlandmonkey (Initiate) on Nov 25, 2009 at 15:44 UTC | |
|
PLZ use <code> tags! :)
by LanX (Saint) on Nov 25, 2009 at 15:26 UTC | |
|
Re: New to Perl. How to loop!
by jethro (Monsignor) on Nov 25, 2009 at 15:27 UTC |