Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> SP and Perl with Inout parameter

SP and Perl with Inout parameter

From: John Giblin <jwgiblin3_at_hotmail.com>
Date: 17 Jul 2003 21:11:46 -0700
Message-ID: <3d6785ec.0307172011.3817aada@posting.google.com>


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

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US