$database is the name of the database, as it is not included in the data
source name.  On my $server there are dozens of databases so here I
specify the one where the stored procedure exists.

However, when I do
$DBH = DBI->connect("dbi:Sybase:$server", $user, $password);
$sth = $DBH->prepare("$database..storedProcedure $parm");
$sth->execute();
It always give me error saying the database is not found.

-----Original Message-----
From: Vorce, Tim (T.) [mailto:[EMAIL PROTECTED]] 
Sent: Thursday, December 19, 2002 7:38 AM
To: 'Zhao, Charles'; [EMAIL PROTECTED]
Subject: RE: Perl DBI and Stored Procedures


I don't know what your $database variable holds.  The syntax that I use
is this:

$update_cursor = $dbh->prepare("begin sp_Del_MDSAA11_STUSRAPTKN(
  \'$id\' ,\'$co\', \'$st\' ,
  \'$sc\' ,\'$ap\', \'$tk\' ,
  \'$ad\' ,
  :output     , :out_msg); end;");

I've got 7 input variables here and 2 output ones.  You can use
placeholders if you wish.

Tim Vorce
Ford Motor Company
[EMAIL PROTECTED]


-----Original Message-----
From: Zhao, Charles [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, December 18, 2002 4:50 PM
To: [EMAIL PROTECTED]
Subject: RE: Perl DBI and Stored Procedures



Thanks for all the good help on this question ... However, I still need
more help to get it to work.

use DBI;
...
$DBH = DBI->connect("dbi:Sybase:$server", $user, $password);
// unless ($DBH) { ... }
// now I have have tried the following and neither one worked: 1. $sth =
$DBH->prepare("$database..storedProcedure($parm)");
$sth->execute();
2.
$sth = $DBH->prepare("{$database..storedProcedure($parm);}");
$sth->execute();
3.
$sth = $DBH->prepare("BEGIN $database..storedProcedure($parm); END;");
// Oracle format $sth->execute();

And some variations, but I always got "no statement executing" msg with
syntax error in the statement preparation.


Any ideas what's wrong with the above?

Thanks a lot.

-----Original Message-----
From: Brien Pirkle [mailto:[EMAIL PROTECTED]] 
Sent: Thursday, December 05, 2002 12:38 AM
To: 'Zhao, Charles '; '[EMAIL PROTECTED] '
Subject: RE: Perl DBI and Stored Procedures


Charles,

I recently asked the same question...........try something like this:

######################
use DBI; 
        my $dbh = DBI->connect('DBI:ODBC:OSTDB', 'user', 'password') 
                or die "Couldn't connect to database: " . DBI->errstr; 
 
my $sth = $dbh->prepare('{call sp_foo}'); 
$sth->execute(); 

######################

Rgds,

Brien


-----Original Message-----
From: Zhao, Charles
To: [EMAIL PROTECTED]
Sent: 04/12/02 23:27
Subject: Perl DBI and Stored Procedures

I need to call stored procedures directly from Perl -- don't want to use
any shell script in between.  Can anybody please give me any tips how to
do it?
 
Thanks.



This email was virus and content checked by e:)scan before entering the
Microgen network.


CONFIDENTIALITY AND DISCLAIMER NOTICE 

The information contained in this e-mail and any attachments 
is confidential and intended for the addressee only and may 
be protected by copyright.  Copying or forwarding any part of 
this e-mail is prohibited. If you have received this e-mail in 
error please delete it and notify us by telephone or return 
e-mail immediately. Any views or opinions contained in 
this message are solely those of the sender and do not 
necessarily represent those of Microgen-OST Limited. 
We advise you to carry out your own virus check before 
opening any attachments as we do not accept liability for 
any damage sustained as a result of any software viruses.

Microgen-OST Limited registered address: 
11, Park Street, 
Windsor, 
Berkshire 
SL4 1LU 

Company Registration No 3475849 

Reply via email to