Executing sproc containing multiple inserts and commits with Perl DBI

From: Femi (femibyte_at_gmail.com)
Date: 01/28/05


Date: 28 Jan 2005 12:36:42 -0800

Hi all, I inherited an sproc which contains multiple insert statements
followed by subsequent commits.
I have the problem that when I execute this sproc using the Perl DBI
library it only seems to execute the first statement and not the
others.

The sproc looks like this :

begin
...
insert into table A
<dataset 1>
commit transaction

insert into table A
<dataset2>
commit transaction

insert into table A
<dataset3>
commit transaction

end

Unfortunately, only dataset1 gets inserted, not dataset2 or dataset3
into the table.

My DBI code looks like this:

my $dbh = DBI->connect($dsn, $dbUser, $dbPwd);
my $sth;

...

my $qry = qq{exec $sprocName \@arg1=$val1, \@arg2=$val2};
$sth=$dbh->prepare($qry);
$sth->execute() or die "Can't Execute" . $sth->errstr();

do {
while (@row = $sth->fetchrow_array)
{
print "@row\n";
}
} while ($sth->{syb_more_results});

Ideas anyone?

Femi



Relevant Pages

  • Re: HELP ME
    ... We need to execute update first and if SQL%ROWCOUNT < 1 then need to ... any User Define Exception to be handled and then use Raise Exception ... Above code template does not specify Commit statement. ... Name, Table primary key etc. ...
    (comp.databases.oracle.misc)
  • Re: ADO and MetaData
    ... The application is using ADO + Delphi 7 and has been operating without ... Execute query ... Commit Tran ...
    (borland.public.delphi.database.ado)
  • Re: [fw-wiz] Botnets, IRC servers and firewalls?
    ... Take the execute bit off the place where attachments ... A user that runs an un-protected machine, or anyone for that matter, can ... be used to DDoS, spam, bounce hackers, commit frauds, etc. ... Well than, speaking in the philosophical level, why shouldn't an ISP ...
    (Firewall-Wizards)
  • Re: Error - Please Help
    ... I am getting an error when I execute a procedure:- ...   COMMIT; ... See SQLNET.LOG to find secondary error if not provided ...
    (comp.databases.oracle.server)
  • Re: Underage drinking.
    ... without the threat of the death penalty, but I agree that it doesn't ... significantly decrease the number of people who would decide to commit ... Assuming you actully execute the right person. ... an innocent person and left a murderer ...
    (alt.fan.harry-potter)