Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> SP and Perl with Inout parameter
I am trying to get the return var from a sp in oracle. For some reason
my sp is not executing at all with no errors
here is a snippet:
my $id; #holds the return value from Oracle stored procedure
my $func = $dbh->prepare( "BEGIN
travel.Attributes_Update(:Id,:Name,:Icon,:Comment); END; ");
$func->bind_param_inout(":Id", \$id,0);
$func->bind_param(":Name", 'test');
$func->bind_param(":Icon", 'test.jpg');
$func->bind_param(":Comment", '');
$func->execute;
print "id =$id ";
$dbh->commit;
if( $@ ) {
die "Execution of stored procedure failed: $DBI::errstr\n";
# $dbh->rollback;
}
print "$id ";
print "Execution of stored procedure returned $id\n";
SP:
(
Id in out number,
Name in varchar2,
Icon varchar2,
Comment varchar2
)
as
begin
if Id = 0 then
select travel.seq_attributes.nextval into Id from dual;
insert into Attributes values(Id, Name, Icon, Comment); commit; else update travel.Attributes set Name = Name, Icon = Icon, COMMENTs = Comment where ID =Id;
end if;
end; Received on Thu Jul 17 2003 - 23:11:46 CDT
![]() |
![]() |