mr_cool has asked for the wisdom of the Perl Monks concerning the following question:

Hi I am calling a stored procedure from my perl program and getting the value from the database. while compiling, it says wrong number or types of arguments in call to 'PROC_BY_SERIAL_NO'. i don't know what would be the problem. Could anyone help me to solve it..... I have written the code and the error below. perl code:
#!/usr/bin/perl5 use strict; use DBI; use DBD::Oracle; my $Sno = "232323277"; my $appname = "drf-120"; my $max = 12; my $maxs = 120; my $warra =""; my $return = ""; my $dbh; my $csr; $ENV{'ORACLE_HOME'} = "/oracle/product/current"; $dbh = DBI->connect('dbi:Oracle:sdfr','wert23','ratyou') or die "Unable to connect: $DBI::errstr"; $dbh->{RaiseError} = 1; $csr = $dbh->prepare(q{ BEGIN proc_by_serial_no( :serial_number, :app_name, :max_time, :max_size, :warranty_tbl, :return_status ); END; }); # The values are _copied_ here $csr->bind_param(":serial_number", $Sno); $csr->bind_param(":app_name", $appname); $csr->bind_param(":max_time", $max); $csr->bind_param(":max_size", $maxs); $csr->bind_param_inout(":warranty_tbl", \$warra, -10); $csr->bind_param_inout(":return_status", \$return, 100); $csr->execute or die "exec-error $csr->errstr\n"; $csr->finish; print $Sno, "\n"; print $appname, "\n"; print $return, "\n"; $dbh->disconnect;
------------------------------------------------------------------------
The error received is .... ORA-06550: line 3, column 8: PLS-00306: wrong number or types of arguments in call to 'PROC_BY_SERI +AL_NO' ORA-06550: line 3, column 8: PL/SQL: Statement ignored (DBD: oexec error) at testpl1.pl line 43. Database handle destroyed without explicit disconnect. ---------------------------------------------------------------------- +-------------
Thanks in Advance Chintu

Replies are listed 'Best First'.
Re: Need Help in calling PL/SQL Stored procedures from perl program
by foogod (Friar) on Nov 18, 2001 at 17:40 UTC

    Ok, first off your prepare statements look correct, you are using BEGIN & END properly.

    I believe you are running into problems with this code:

    # The values are _copied_ here $csr->bind_param(":serial_number", $Sno); $csr->bind_param(":app_name", $appname); $csr->bind_param(":max_time", $max); $csr->bind_param(":max_size", $maxs); $csr->bind_param_inout(":warranty_tbl", \$warra, -10); $csr->bind_param_inout(":return_status", \$return, 100);

    You do not need the colon (:) prefix to the param name. I.E.

    # The values are _copied_ here $csr->bind_param("serial_number", $Sno); $csr->bind_param("app_name", $appname); $csr->bind_param("max_time", $max); $csr->bind_param("max_size", $maxs); $csr->bind_param_inout("warranty_tbl", \$warra, -10); $csr->bind_param_inout("return_status", \$return, 100);

    should work properly.

    Normally I use numeric values for my procedure, so this is never an issue, but try this and see what happens.

    - f o o g o d

      Thanks for your response. But still its not working. if i remov the colon, it says "cannot bind" Regards Chintu
        i tried numeric values also. but no luck ---Chintu