Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8840537
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T10:29:11+00:00 2026-06-14T10:29:11+00:00

I am using the following code to insert values in to a table. String

  • 0

I am using the following code to insert values in to a table.

String sql = "INSERT INTO APPLICATION VALUES (?,?,?,?,?,?,TO_DATE(?,'DD/MMYYYY'),?,TO_DATE(?,'DD/MM/YYYY'),?,?,?,?,?,SYSDATE,'X',?)";
PreparedStatement pstmt = conn.prepareStatement(sql);
pstmt.setInt(1,Integer.parseInt(sr));
pstmt.setString(2,nm);
pstmt.setString(3,(String)session.getValue("ITSGTYP"));
pstmt.setString(4,pst);
pstmt.setString(5,dox);
pstmt.setString(6,zo);
pstmt.setString(7,dob);
pstmt.setString(8,cdr);
pstmt.setString(9,cdrdt);
pstmt.setString(10,qual);
pstmt.setString(11,mail);
pstmt.setString(12,bond);
pstmt.setInt(13,Integer.parseInt((String)session.getValue("USER")));
pstmt.setString(14,request.getRemoteAddr());
pstmt.setString(17,place);

The description of the table into which the values are inserted is as follows

EMP_ID                    NOT NULL NUMBER(6)
NAME                      VARCHAR2(25)
APPLN_TYP                 VARCHAR2(10)
POST                      VARCHAR2(100)
DIV                       VARCHAR2(25)
ZONE                      VARCHAR2(5)
DOB                       DATE
CADRE                     VARCHAR2(5)
CADRE_DATE                DATE
QUALIFICATION             VARCHAR2(100)
EMAIL_ID                  VARCHAR2(70)
BOND                      VARCHAR2(3)
SUBMITTED_BY              NUMBER(6)
SUBMIT_IP                 VARCHAR2(30)
SUBMIT_DATE               DATE
FLAG                      VARCHAR2(1)
PLACE                     VARCHAR2(20)

While executing the above code I am getting the following error

 Error: java.sql.SQLException: Invalid column index

This query was working fine before.

My previous table didn’t have the PLACE column. I had to insert it at a later point.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T10:29:12+00:00Added an answer on June 14, 2026 at 10:29 am

    Replace pstmt.setString(17,place);

    with

    pstmt.setString(15,place);

    The reason for error you get is :

    You don’t have 17 ? symbols in your query for prepared statement, you only have 15 ? symbols that means you can only set 15 values (for 15 columns) for that prepared statement.

    Now what you were doing is you were setting a parameter at 17 th index and you don’t have any column specified at index 17 in your query, you only have 15 columns and 15 ? symbols for the values to be inserted at respective 15 columns.

    So replace it with what I mentioned above and it will work.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to insert data into a table using the following code public User
I insert into an Oracle DB Table using the following insert string (Approx --
I am trying to insert a row in ms-sql table using the following code
I'm using the following code: $query = $dbh->prepare(INSERT into crm_order_errors .SET (order_id, number_of_attempts, last_attempt)
I'm try to insert values into my sqlite table using a python script. It
I've the following code: $salt=uniqid(mt_rand(), false); #Add data to tables mysql_query(INSERT INTO accounts VALUES('$user',
I am unable to create a table and insert the values into it using
I am using this code to insert some values in MySql table: <?php mysql_connect(localhost,root,root);
Im importing a csv to my sql server table using the following code SqlCommand
Currently trying to insert an object into the Customer table using a test SQL

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.