user2783755
user2783755

Reputation: 588

Debugging runtime pl/sql errors

I’m new in pl/sq.

So, I’m trying to call pl/sql stored procedure from Java, but appears error:

wrong number or types of arguments in call to ‘searchuser’.

Where can I find most specific exception?

Is there some error logs or errors table in oracle? How can I debug these kind of problems?

Thanks!

Upvotes: 0

Views: 249

Answers (1)

PT_STAR
PT_STAR

Reputation: 505

one thing is if you call stored procedures from java: don't forget to register the function result. Example Java code:

        CallableStatement cstmt = connection.prepareCall("{? = call xxx.checkArea(?,?)}");

        // the 1st Parameter is the result of the function checkArea
        cstmt.registerOutParameter(1, Types.INTEGER);   // Function Return
        cstmt.setInt(2, status);                        // Parameter 1 (in)
        cstmt.registerOutParameter(3, Types.INTEGER);   // Parameter 2 (out)

        // execute the call
        cstmt.execute();

        // check the results
        sessionId = cstmt.getInt(1); // Session-ID
        rows = cstmt.getInt(3);      // Rows

The PL/SQL Function is declared as following:

  function checkArea(pi_area     in  number,
                     po_rows     out number) return number;

Upvotes: 1

Related Questions