Generally a function returns a value which you must assign to something. So
you could do
my $sql = qq[select OWNER.MY_FUNCTION(?,$action,?,$meta_type) from dual];
instead of trying to execute an anonymous PLSQL block, which is probably
more efficient anyway.
If you need to do it in PLSQL because of pragma restrictions etc then you
would have to
my $sql = qq[BEGIN
:outval := OWNER.MY_FUNCTION(:in_id,$action,:in_name,$meta_type);
END;]
then also do bind_param_inout(":outval", \$outval.....)
and bin_param_in(":in_id".... etc for the other parameters.
I believe it is all in the DBD::Oracle perldoc.
Ken.
-----Original Message-----
From: NYIMI Jose (BMB) [mailto:[EMAIL PROTECTED]]
Sent: 18 November 2002 14:33
To: [EMAIL PROTECTED]
Subject: Execute an Oracle Function (not a Procedure)
Hello,
I have a function in our Oracle database (a function, not a procedure).
I would like to execute this function from my perl script using DBI.
I wrote something like this :
my $sql=qq[
BEGIN
OWNER.MY_FUNCTION(?,$action,?,$meta_type);
END;
];
my $dbh=DBI->connect("dbi:Oracle:$db_name",$db_user,$db_passwd);
$dbh->{AutoCommit}=0;
$dbh->{RaiseError}=1;
my $sth=$dbh->prepare($sql);
while(my($id,$name)=each %$data){
$sth->execute($id,$name);
}
$dbh->commit();
$dbh->disconnect();
But I'm getting the following error message:
DBD::Oracle::st execute failed: ORA-06550: line 2, column 48:
PLS-00201: identifier 'MAIN' must be declared
ORA-06550: line 2, column 13:
How can I fix it ? Any idea is welcome.
Thanks in advance for your help.
Jos�.
**** DISCLAIMER ****
"This e-mail and any attachment thereto may contain information which is
confidential and/or protected by intellectual property rights and are
intended for the sole use of the recipient(s) named above.
Any use of the information contained herein (including, but not limited to,
total or partial reproduction, communication or distribution in any form) by
other persons than the designated recipient(s) is prohibited.
If you have received this e-mail in error, please notify the sender either
by telephone or by e-mail and delete the material from any computer".
Thank you for your cooperation.
For further information about Proximus mobile phone services please see our
website at http://www.proximus.be or refer to any Proximus agent.