I have been experiencing some frustrations trying to make a simple Oracle cursor retrieval procedure work with JDBC.
I keep on getting an error of "[Oracle][ODBC][Ora]ORA-06553: PLS-306: wrong number or types of arguments in call to 'GETNAME'", but I cannot figure out what I am doing wrong.
Here is my code in Java:
CallableStatement stmt = connection.prepareCall("call getName(?)");
stmt.registerOutParameter(1, OracleTypes.CURSOR);
stmt.execute();
stmt.close();
con.close();
Here is my procedure in Oracle:
CREATE OR REPLACE PROCEDURE getName(cur out SYS_REFCURSOR)
IS
BEGIN
OPEN cur FOR
SELECT name FROM customer;
END;
The error occurs on stmt.execute()
.
Thanks in advance.
By the way, I am working with Oracle 10.2.0.