Using SQL stored procedure in Perl 
Author Message
 Using SQL stored procedure in Perl

Hi, I have SQL stored procedure called "getinfo" with a SQL statement
"select id, name from customer".  Now how do I write the perl script to
use this stored procedure and display the result to the browser by using
DBConnect(), DBDoSQL() and other functions?

Thank you!!!!!

Sent via Deja.com http://www.*-*-*.com/
Before you buy.



Wed, 18 Jun 1902 08:00:00 GMT  
 Using SQL stored procedure in Perl
Hi ,
  Take a look at the following piece of code...i think this will help
you out...

------------------------begin of code---------------------------------
my($cntr)=0;  #This is the input parameter for my procedure
my($res)='';  #This is the output  from my procedure

my($dbh) = DBI->connect($dsname, $dbuser, $dbpasswd);

my ($sql_stmt) = "begin gimmedateback_procedure(:1,:2); end;";
my ($csr) = $dbh->prepare($sql_stmt);

$csr->bind_param(1, $cntr);
$csr->bind_param_inout(2, \$res,10);

my $status = $csr->execute();

------------------------end of code-----------------------------------

P.S:- Please trap the errors.....in the above code

Rajesh

"The fact is, your brains are built to do Perl programming
                                                          --Larry Wall"


Quote:

> Hi, I have SQL stored procedure called "getinfo" with a SQL statement
> "select id, name from customer".  Now how do I write the perl script
to
> use this stored procedure and display the result to the browser by
using
> DBConnect(), DBDoSQL() and other functions?

> Thank you!!!!!

> Sent via Deja.com http://www.deja.com/
> Before you buy.

Sent via Deja.com http://www.deja.com/
Before you buy.


Wed, 18 Jun 1902 08:00:00 GMT  
 Using SQL stored procedure in Perl

Quote:
>Hi, I have SQL stored procedure called "getinfo" with a SQL statement
>"select id, name from customer".  Now how do I write the perl script to
>use this stored procedure and display the result to the browser by using
>DBConnect(), DBDoSQL() and other functions?

The procedure isn't directly accessed via Perl, but via an SQL query
passed back to the server with the appropriate function call.

--

Computer Operations Manager (Alpha Geek)   http://www.foiservices.com
FOI Services, Inc./DIOGENES                301-975-0110
---------------------------------------------------------------------------



Wed, 18 Jun 1902 08:00:00 GMT  
 Using SQL stored procedure in Perl

Quote:

>Hi, I have SQL stored procedure called "getinfo" with a SQL statement
>"select id, name from customer".  Now how do I write the perl script to
>use this stored procedure and display the result to the browser by using
>DBConnect(), DBDoSQL() and other functions?

Presumably by having a look at the DBI FAQ (located on your harddisk).

Some interesting entries for v.0.37 are :

5.3 How can I invoke stored procedures with DBI?
        and
5.4 How can I get return values from stored procedures with DBI?

And <http://www.symbolstone.org/technology/perl/DBI/index.html>
is also a nice place to visit, for modules, FAQs, tutorials etc.

You might also have a look at the DBIx modules (like DBIx::CGI and
DBIx::HTMLView) on CPAN, but I don't know their quality or contents.

Have fun,

Michel.



Wed, 18 Jun 1902 08:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Using Embedded SQL vs Stored procedures in Perl DBI?DBD for Oracle

2. LONG: Req: Help in retrieving values from SQL Server stored procedure using Win32::ODBC

3. Using SQL stored procedure

4. Perl Library to execute stored procedures in MS-SQL Server

5. SQL 2000 Stored procedure called from PERL not responding

6. Executing DEL and UPDT PL/SQL stored procedures from PERL

7. Executing DEL and UPDT PL/SQL stored procedures from PERL

8. ODBC, SQL Server, Stored Procedures

9. Binding Cursors returned from PL/SQL stored procedure

10. ODBC, SQL Server, Stored Procedures

11. pl/sql stored procedure with Table input

12. pl/sql stored procedure

 

 
Powered by phpBB® Forum Software