Multiple Use of a Single Bind Parameter Runs Into SQLException (Doc ID 353644.1)

Last updated on SEPTEMBER 01, 2014

Applies to:

JDBC
Information in this document applies to any platform.

Symptoms

The following code snippet how to make multiple use of a bind parameter. This code worked with Oracle JDBC Drivers < 10.x.


PreparedStatement pstmt = 
  conn.prepareStatement("SELECT users_ID FROM Users t WHERE t.users_ID = :1 and t.companies_id = :1");
pstmt.setInt(1,1);
pstmt.execute();

throws:
java.sql.SQLException: Missing IN or OUT parameter at index:: 2

after upgrading Oracle JDBC Driver to 10.x

Changes

Upgrade of Oracle JDBC Driver from "< 10.x" to ">= 10.x".

Cause

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms