philosophia has asked for the wisdom of the Perl Monks concerning the following question:
$sql = "SELECT * FROM sp WHERE NOT EXISTS (SELECT * FROM SP,SUPPLIER W +HERE SUPPLIER.snum = SP.snum)"; $sth = $dbh->prepare($sql); $sth->execute or die "Error: $DBI::errstr\n"; $sth->bind_col(1,\$spnum); $sth->bind_col(2,\$snum); $sth->bind_col(3,\$pnum); $sth->bind_col(4,\$qty); while($sth->fetch){ $sql = "INSERT INTO sp_err SELECT * FROM sp WHERE spnum = $spnum +&& snum = $snum"; $sth = $dbh->prepare($sql); $sth->execute or die "Error: $DBI::errstr\n"; print "deleted row"; }
Edit by castaway - added code tags
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: nested dbi queries question
by VSarkiss (Monsignor) on Feb 01, 2005 at 23:18 UTC | |
by philosophia (Sexton) on Feb 01, 2005 at 23:23 UTC | |
by runrig (Abbot) on Feb 02, 2005 at 00:11 UTC | |
by philosophia (Sexton) on Feb 03, 2005 at 20:02 UTC | |
|
Re: nested dbi queries question
by Grundle (Scribe) on Feb 01, 2005 at 22:43 UTC | |
by philosophia (Sexton) on Feb 01, 2005 at 23:19 UTC | |
|
Re: nested dbi queries question
by trammell (Priest) on Feb 01, 2005 at 22:58 UTC | |
by philosophia (Sexton) on Feb 01, 2005 at 23:28 UTC | |
by trammell (Priest) on Feb 01, 2005 at 23:40 UTC | |
by philosophia (Sexton) on Feb 02, 2005 at 00:02 UTC | |
by philosophia (Sexton) on Feb 01, 2005 at 23:36 UTC | |
by VSarkiss (Monsignor) on Feb 02, 2005 at 16:39 UTC | |
|
Re: nested dbi queries question
by jarich (Curate) on Feb 02, 2005 at 07:40 UTC |