This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes JDBC and Relational Databases and the fly likes error of missing values Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "error of missing values" Watch "error of missing values" New topic
Author

error of missing values

Megha Singhal
Ranch Hand

Joined: Feb 28, 2012
Posts: 225

AddUser.java



addUser.jsp

when i'm trying the above code the following error is coming
"ORA-00947: not enough values"
sarada bokka
Ranch Hand

Joined: Jan 13, 2010
Posts: 80
This is a DB issue.
It say's the no of columns doesn't match with what you are trying to add. PERSONS table might be containing more or less columns.
Neeraj Dhiman
Ranch Hand

Joined: Dec 19, 2011
Posts: 67

This is probabaly the error of unequal set column and values you are inserting, in your SQL Query. just try this.


Correct Me if i am wrong
Swastik Dey
Rancher

Joined: Jan 08, 2009
Posts: 1508
    
    5

Use PreparedStatement.


Swastik
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 20077
    
  30

Neeraj is right in that you need to specify the columns for inserting. Right now your statement expects a value for each and every column, in the right order. You're missing at least one value (possibly the auto-generated primary key?). Swastik is right that you should use PreparedStatement to prevent SQL injection.

And Megha, I believe this is the second time you posted code with some lines with very much spaces at the end. These mess up our forum layout a bit; can you try to remove those spaces next time? I've done it this time for you.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions How To Answer Questions
 
Have you checked out Aspose?
 
subject: error of missing values
 
It's not a secret anymore!