in reply to Re: Getting error while invoking a SQL Procedure
in thread Getting error while invoking a SQL Procedure

Apologies for any confusion. I need to call a procedure and pass certain parameters to it. I am not able find out the correct way to do it.
  • Comment on Re^2: Getting error while invoking a SQL Procedure

Replies are listed 'Best First'.
Re^3: Getting error while invoking a SQL Procedure
by graff (Chancellor) on Sep 08, 2009 at 13:24 UTC
    I think you don't need any special treatment with "BEGIN" and "END" -- the sql statement should just be the procedure call, and when you execute it, you just have to make sure you pass the right number of params in the right order:
    my $sql = "CBT.SP_LOG_CONSOLE(?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"; my $sth = $dbh->prepare( $sql ); my @params = ...; # you need 10 values here $sth->execute( @params );
    If that comes back with an error from Oracle, maybe there's a problem with the stored procedure at the server side.

      You don't need the BEGIN/END but if you just take them out it won't work. You'd have to prefix the sql with "call" and you don't want to do that as call gobbles up NO_DATA_FOUND errors (documented by Oracle somewhere).