Re: Oracle functions through DBI?



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" <riccardo.bonuccelli@xxxxxxxxx>
To: <dbi-users@xxxxxxxx>
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

.



Relevant Pages

  • Re: Error in calling stored procedure via DB link
    ... "Paul Clement" wrote: ... Below is an Oracle KB article that documents the issue. ... Calling Stored Procedure over Dblink Using Oracle OleDb Provider Fails ... > symptom: Using command type adCmdStoredProc ...
    (microsoft.public.vb.database.ado)
  • Re: Performance problems with StoredProcedure in Web application
    ... you could probably just ignore my comments about stored procedure performance as compared to textual queries because they ... As for your question about how to avoid using a cursor (as I suggested was possible in Oracle) read the following paragraph for more ... The .NET Framework Data Provider for Oracle does not support batched SQL statements. ... CURSOR output parameters to fill a DataSet, ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Passing Back Table Information from Oracle .NET Stored Procedures
    ... stored procedure, not in the typical PL/SQL sense. ... I don't care if it's MS SQL in-line code or Oracle in-line code, MS SQL Server, Oracle Proc, or this so called .NET Stored Procedure using a Select statement, they are all returning a RESULT SET whether it be one row or multiple rows. ... I used SqlContext above because I don't want to bother registering at the Oracle site to download their Oracle Database Extensions for .NET in order to get at the presumably extant OracleContext class. ...
    (microsoft.public.dotnet.languages.csharp)
  • RE: oracle win2k ORA-1222 problems
    ... AS does not provide a package, but you can and should install both DBI and DBD::Oracle from ftp.esoftmatic.com. ... Oracle is listed as "failed" if I recall correctly. ... Data Source is DBI:Oracle:Space ...
    (perl.dbi.users)
  • Re: EXEC syntax for SP which returns row set
    ... >>> Oracle experts, none of whom seem to know. ... >> SQL> create or replace package returncur is ... > I don't know why you are supplying the above example. ... to illustrate HOW you'd call a stored procedure and return ...
    (comp.databases.oracle.server)