Gourab Sengupta Gourab Sengupta - 1 year ago 51
Perl Question

Calling a stored proc from perl

I am running this subroutine from the main script.

print "parameter passed: $_[0]";
my $connect_string = 'test/test@testdb';
my $sqlplus_settings = '';
my $task = '';
my $result = qx { sqlplus $connect_string << EOF
$sqlplus_settings exec {pkgname.procedure($_[0], 'abc',$task);

When it is getting called from the main script
, it is printing the first line with the input parameter. But the procedure is not getting executed.


As mentioned by user @choroba in the comments above, the best way IMHO is to use Perl's DBI module.

Here is an example of calling your stored procedure that would work with Oracle:

$dbh->do("BEGIN your_procedure; END;");

And here is a link to help you get started with the DBI module:

Perl DBI