develooper Front page | perl.dbi.users | Postings from May 2012

Trying to use perl to call oracle stored proc to return an object.

Thread Next
From:
Stricker, Scott
Date:
May 2, 2012 09:06
Subject:
Trying to use perl to call oracle stored proc to return an object.
Message ID:
9565B362D76BF144830434A0F87EEC541E5D8CC2@XMBVAG73.northgrum.com
All:

I'm trying to use perl to invoke a stored procedure to return an object.

Oracle Procedure is defined as

PROCEDURE FetchTrackObjbyID  (  p_ID IN TRACK.ID%TYPE  , p_TARGET OUT TARGET  )

Where p_ID is numeric and p_TARGET is the TARGET object type.

When I 'execute', I get

DBD::Oracle::st execute failed: ORA-06550: line 2, column 5:
PLS-00306: wrong number or types of arguments in call to 'FETCHTRACKOBJBYID'
ORA-06550: line 2, column 5:
PL/SQL: Statement ignored (DBD ERROR: error possibly near <*> indicator at char 10 in 'BEGIN
    <*>FetchTrackObjbyID(:p_id, :p_target);
END;
') [for Statement "BEGIN
    FetchTrackObjbyID(:p_ID, :p_Target);
END;
" with ParamValues: :p_id=1, :p_target=undef] at


So far, I've got

    my $i = 5;
    my $p_Target;  # should this be either @p_Target or %p_Target
     my $sqlstmt= <<"END_SQL";
BEGIN
    FetchTrackObjbyID(:p_ID, :p_Target);
END;
END_SQL

        my $sth = $dbh->prepare($sqlstmt) or die "Can't prepare statement\n$sqlstmt\n$DBI::errstr\n";
        $sth->bind_param_inout(":p_Target",\$p_Target, 20) or die "bind(target) err is $DBI::errstr";  # Should I specify a bind type and if so, what type?
        $sth->bind_param(":p_ID",$i) or die "bind(ID) err is  $DBI::errstr\n";
        $sth->execute();

Hoping it is something really simple.  Thanks for any help

E. Scott Stricker @ Work





Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About