Executing DEL and UPDT PL/SQL stored procedures from PERL 
Author Message
 Executing DEL and UPDT PL/SQL stored procedures from PERL

Hi,

i was wondering whether it is possible (and more importantly how!) to
execute some PL/SQL stored procedures on Oracle (stprocs) from PERL.

I know using DBI, perl can execute SELECT stprocs but what about
DELETE and UPDATES? Also can those DELETE and UPDATES stprocs return a
value to PERL (say number of rows deleted or updated)?

In these codes, im actually calling a stproc found in a Package and it
simply select date from dual.

use DBI qw(:sql_types);

       my $today;

       $csr = $dbh->prepare(q{
             BEGIN
                 PACK_TEST.TEST_PROC (:today);
             END;
       });

       $csr->bind_param_inout(":today", \$today, 20);
       $csr->execute;
       print "Today is $today\n";

       $dbh->disconnect;

Is there some equivalent codes for DELETE and UPDATE?

Thanks,

GC.



Sun, 08 Feb 2004 21:06:16 GMT  
 Executing DEL and UPDT PL/SQL stored procedures from PERL
Quote:

> Hi,

> i was wondering whether it is possible (and more importantly how!) to
> execute some PL/SQL stored procedures on Oracle (stprocs) from PERL.

> I know using DBI, perl can execute SELECT stprocs but what about
> DELETE and UPDATES? Also can those DELETE and UPDATES stprocs return a
> value to PERL (say number of rows deleted or updated)?

> In these codes, im actually calling a stproc found in a Package and it
> simply select date from dual.

> use DBI qw(:sql_types);

>        my $today;

>        $csr = $dbh->prepare(q{
>              BEGIN
>                  PACK_TEST.TEST_PROC (:today);
>              END;
>        });

>        $csr->bind_param_inout(":today", \$today, 20);
>        $csr->execute;
>        print "Today is $today\n";

>        $dbh->disconnect;

> Is there some equivalent codes for DELETE and UPDATE?

> Thanks,

> GC.

It depends on how the PL/SQL is written.  If you want to return values,
then write the procedure/function so values will be returned.  There are
plenty of examples in the DBD::Oracle docs on using PL/SQL from Perl.

If you are up to the challenge, try building and working with
Oracle::OCI.  It gic\ves direct access to low level Oracle functions
(just like C/C++ OCI programming) as well as internal function directly
from Perl.
--
Ron Reidy
Oracle DBA
Reidy Consulting, L.L.C.



Mon, 09 Feb 2004 05:44:02 GMT  
 
 [ 2 post ] 

 Relevant Pages 

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

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

3. Binding Cursors returned from PL/SQL stored procedure

4. pl/sql stored procedure with Table input

5. pl/sql stored procedure

6. OraPerl and PL/SQL Stored Procedure

7. Executing MSQL stored procedure from perl

8. SQL 2000 Stored procedure called from PERL not responding

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

10. Using SQL stored procedure in Perl

11. Executing Stored Procedures using Win32::ODBC

12. Oraperl - executing stored procedures

 

 
Powered by phpBB® Forum Software