Hello,
A delete doesn't return any rows with is why your fetchrow isn't able to
return any data and you never get inside the while loop. I'm assuming
that you want to do the delete and then show the user what it is that they
just blew away.
If this is the case, ou'd probably be better off checking for a SQL error.
If you want to print the row that was deleted then you'd probably need to
do a select prior to doing the delete.
So:
- Get 'where' clause restriction.
- prepare a select and delete
- execute the select and retrieve the values into a variable
- execute the delete
- if the error checking is ok then print the row retrieved with the select
You might also need to do a commit depending on the settings of your db.
hope this helps
john
Mark Martin <[EMAIL PROTECTED]>
10/07/2001 10:34 PM
To: [EMAIL PROTECTED]
cc:
Subject: Newbie Deleting Table Records Problem
Hi,
not having much luck with the following
my $sql = qq{delete from table where field = something}or warn ........;
my $sth1 = $dbh->prepare ($sql1) or warn ...........;
$sth1->execute() or warn ..............;
while (@row1 = $sth1->fetchrow) {
print" @row1 records were deleted from Table: bankdiffs
.\n";
}
It just wont go inside the while and gives the following error :
DBD::Oracle::st fetchrow failed: ERROR no statement executing (perhaps you
need to call execute first) at clear.pl line 32.
Cheers - Mark
_____________________________________________
Mark Martin
Computer Centre
National University of Ireland Maynooth
Tel: (01)708 4716/3830
Fax: (01)628 6249