# Example 2 # # Now we call a procedure that has 1 IN parameter. # Here we use bind_param # to bind out parameter to the prepared statement just # like you might # do for an INSERT, UPDATE, DELETE, or SELECT statement. # # I could have used positional placeholders # (e.g. :1, :2, etc.) or # ODBC style placeholders (e.g. ?), but I prefer # Oracle's named # placeholders (but few DBI drivers support them so # they're not portable). my $err_code = -20001; $csr = $db->prepare(q{ BEGIN PLSQL_EXAMPLE.PROC_IN(:err_code); END; }); $csr->bind_param(":err_code", $err_code); # PROC_IN will RAISE_APPLICATION_ERROR which will # cause the execute to 'fail'. # Because we set RaiseError, the DBI will croak (die) # so we catch that with eval. eval { $csr->execute; }; print 'After proc_in: $@=',"'$@', errstr=$DBI::errstr, ret_val=$ret_val\n";