The DBI is version 11.2. Ideally a status/single result set. I did rtfm
before I posted the ques.:
?????????????
=head2 5.3 How can I invoke stored procedures with DBI?
The DBI does not define a database-independent way of calling stored
procedures.
However, most database that support them also provide a way to call
them from SQL statements - and the DBI certainly supports that.
So, assuming that you have created a stored procedure within the target
database, I<eg>, an Oracle database, you can use C<$dbh>->C<do()> to
immediately execute the procedure. For example,
$dbh->do( "BEGIN someProcedure; END;" ); # Oracle-specific
You should also be able to C<prepare> and C<execute>, which is
the recommended way if you'll be calling the procedure often.
?????????????
It talks about Oracle and says to use the way to call sps from SQL
statements for most db. It is tricky in DB2 since you use "CALL <stored
procedure>" to invoke sps from a sql statement but Perl treats the <stored
procedure> as a dll and then fails as the e.g. at the bottom. As a beginner
in Perl and I've tried a few different ways but none worked. Any help is
appreciated. Thanks.
Ed.
----- Original Message -----
From: "Harrington Michael" <[EMAIL PROTECTED]>
To: "'Ed Ricci'" <[EMAIL PROTECTED]>
Sent: Sunday, April 28, 2002 7:44 PM
Subject: RE: How to call stored procedure?
> Ed,
>
> rtfm is short for "Read the _______ manual". :)
>
> Looks like you need to call stored procs in DB2, right?
> Multiple result sets, or not?
>
> It's been awhile since I've done this, but could dig up some old code if
> you can wait until tomorrow?
>
> Also, what version is your DBI?
>
>
> > -----Original Message-----
> > From: Ed Ricci [SMTP:[EMAIL PROTECTED]]
> > Sent: Sunday, April 28, 2002 3:41 PM
> > To: dave keefer
> > Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]
> > Subject: Re: How to call stored procedure?
> >
> > Dave - could you be more specific? What is rtfm? And could you give me
a
> > brief eg.?
> >
> > Or Anybody - could you give me a hint on how to invoke stored procedure
> > from
> > Perl?
> >
> > Thanks.
> >
> > Ed.
> >
> > ----- Original Message -----
> > From: "dave keefer" <[EMAIL PROTECTED]>
> > To: "Ed Ricci" <[EMAIL PROTECTED]>
> > Cc: <[EMAIL PROTECTED]>
> > Sent: Friday, April 26, 2002 6:31 PM
> > Subject: Re: How to call stored procedure?
> >
> >
> > > how about rtfm
> > >
> > >
> > >
> > > Ed Ricci wrote:
> > >
> > > > ########################################
> > > > use DBI;
> > > > use DBD::DB2::Constants;
> > > > use DBD::DB2;
> > > >
> > > > $dbh = DBI->connect("dbi:DB2:TEST", "admin", "admin");
> > > >
> > > > #$sql = "CALL TEST.WRITEFILESTATUS ('test','missing')";
> > > > $sql = "INSERT INTO TEST.FILE_TABLE (FILE, STATUS) VALUES ('Tone',
> > > > 'Missing')";
> > > >
> > > > $sth = $dbh->prepare($sql);
> > > > $sth->execute();
> > > > ....
> > > > #######################################
> > > >
> > > > It works for the 2nd $sql (a normal insert statement) but it fails
for
> > > > the 1st $sql (call a stored procedure instead).
> > > >
> > > > The error:
> > > > DBD::DB2::st execute failed: [IBM][CLI Driver][DB2/NT] SQL1109N The
> > > > specified DLL "TEST.WRITEFILESTATUS" could not be loaded.
> > > >
> > > > When I paste and run the 1st $sql: "CALL TEST.WRITEFILESTATUS
> > > > ('test','missing')" in the DB2 command centre and it works.
> > > >
> > > > Please let me know how I should invoke stored procedures within
Perl.
> > > >
> > > > Many Thanks.
> > > >
> > > > Ed
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > _________________________________________________________________
> > > > Chat with friends online, try MSN Messenger:
http://messenger.msn.com
> > >
> > >
> > >
> > >
>
>