Yes one can quite simply at least for a Stored procedure as for a function
you may have to wrap it in some SQL first.

 my $db="";
 my $db = DBI->connect();
 my $desc = 'Comments from user ';
 my $desc_out ="";

 my $sql="begin insert_comment(:p_id ,:p_desc,:p_desc_out); end;";

 my $c=$db->prepare($sql) or die "err 1 is  $DBI::errstr\n";

 $c->bind_param(":p_id",param('id')) or die "err 2 is  $DBI::errstr\n";

 $c->bind_param_inout(":p_desc",\$desc,{ ora_type => ORA_CLOB }) or die "err
3 is  $DBI::errstr\n";

 $c->bind_param_inout(":p_desc_out",\$desc_out,{ ora_type => ORA_CLOB }) or
die "err 3 is  $DBI::errstr\n";

 $c->execute() or die "err 4 is  $DBI::errstr\n";

 my $page_data = $c -> fetchall_arrayref();

 $c->finish();


 print  @$page_data;
print "<BR><BR>";
print $desc_out;

where my insert_comment stored Procedure starts like

CREATE procedure insert_comment(in_ID in NUMBER, in_log in out clob, out_log
in out clob )





----- Original Message ----- 
From: "Riccardo Bonuccelli" <[EMAIL PROTECTED]>
To: <dbi-users@perl.org>
Sent: Wednesday, April 26, 2006 10:46 AM
Subject: Oracle functions through DBI?


Hello,

I was wondering (and found nothing bout that on the web), can I use DBI to
execute some oracle DB functions?
Here's my case: I have a (oracle) function that returns a new free ROW ID
randomly and I have to manage that RI from a perl script. Can I use DBI to
submit the request to oracle? for me it would be much more simple and
efficient than the same old way!!

thanks
Riccardo

Reply via email to