Skip to Main Content

Java Database Connectivity (JDBC)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Attempt to set a parameter name that does not occur in the SQL

avromSep 12 2009 — edited Oct 15 2014
Hi all,

Apologies if this is a very basic question--I'm sort of learning the finer points of Oracle JDBC as I go here.

I have an OracleCallableStatement, stmt, constructed from the following String:

"BEGIN :PNFORFNRESULT := employees_pkg.get_emp_by_pk(:EmployeeId); employees_pkg.lock_emp(:EmployeeId);END;"

When I call

stmt.setObjectAtName(":EmployeeId", new NUMBER(101), OracleTypes.NUMBER);

I get a SQLException with the message,

"Attempt to set a parameter name that does not occur in the SQL: :EmployeeId"

passing in "EmployeeId" (without the colon; I couldn't figure out whether it was needed or not) makes no difference except for the number of colons in the error message.

Am I misunderstanding how setObjectAtName() is supposed to work? Or what sort of String can be used to create an OracleCallableStatement?

Thanks much,
Avrom
This post has been answered by friscoki on Oct 2 2009
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 26 2009
Added on Sep 12 2009
4 comments
5,247 views