Retrieving Oracle Cursor with JDBC
Posted
by BeginnerAmongBeginners
on Stack Overflow
See other posts from Stack Overflow
or by BeginnerAmongBeginners
Published on 2010-05-26T18:57:16Z
Indexed on
2010/05/26
19:01 UTC
Read the original article
Hit count: 193
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.registerOutputParameter(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;
Thanks in advance.
By the way, I am working with Oracle 10.2.0.
© Stack Overflow or respective owner