Share |

ORA-17003: Invalid column index

You are trying to access a column that is not in the select list.

Probably you did not select enough values in the SELECT statement.

eg:


String cs;
cs = readEntry ("connectionstring (machine:port:sid) : ");

String user;
user = readEntry ("user: ");

String pw;
pw = readEntry ("Password: ");

// connect to the database
final Connection conn = DriverManager.getConnection( "jdbc:oracle:thin:@"+cs, user, pw );

Statement statement = conn.createStatement();

ResultSet resultset = statement.executeQuery( "select to_char(sysdate, 'dd mon yyyy') from dual " );
if ( resultset.next() ) {
System.out.println( "Date: "+resultset.getString( 2 ));
}
resultset.close();
statement.close();
conn.close();

In the previous example we only have 1 column in the select list ( a date), but we try to access column 2 [getString(2)], which obviously fails as it does not exists in the resultset.

Either add the column to the select list or change the call to getInt/String/...
 Was this information helpful?  Yes No
If it was not helpful, please take some time to explain why. This is not to ask questions, you can do so in the forum.

Welcome to our forum for Oracle error: ORA-17003 Add your own message



hi..
i'm raman..
while i'm executing this statement in jsp page it is getting an exception saying "INvalied Column Index"
my table in data base contains
uname vrachar2
pwd varchar2
admin int
full_name varchar2

while i execute this update statement i'm getting exception
Connection con = null;
PreparedStatement ps = null;
con = Database.getConnection();
ps=con.prepareStatement("update users set uname=?,pwd=?,admin=?,full_name=? where uname =?");
ps.setString(1,duser);
ps.setString(2,npwd);
ps.setInt(3,ad);
ps.setString(4,fnm);
ps.setString(5,duser);

Add your message

 Please provide your personal info 



 Please ask your message as briefly and clear as possible 

 Spam Protection 
Validation Code: y8jtdo8k0s758xbuj


Ask Your Question

If you need more information about this particular error message, you can leave a forum message.

We are replying to this message whenever we have some spare time, so please do not consider this as a private 'solve my critical issue asap' service.

Should you need professional Oracle Assistance to make your project a success, please have a look at our consultancy services.


Spam Protection

In order to prevent automatic generation of messages, we are asking for a validation code. This code is unique and is generated every time a new message is asked.

If you do not enter the validation correctly, your message will not be recorded.


Forum Rules

Please be polite, do not USE ALL UPPERCASE, no insults, violance or any other threats.