File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes Before insert Trigger 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 "Before insert Trigger" Watch "Before insert Trigger" New topic

Before insert Trigger

Ann Bar

Joined: Apr 04, 2006
Posts: 4

I have a table that has a before insert trigger. The trigger stores a value from another table in the first column. I include values for all columns minus the first one for my sql insert.

I get the error:
java.sql.SQLException: Missing IN or OUT parameter at index:: 1

I think it means I need to include one more column for the insert. How do I do it for the first column with trigger?


String fields[] = new String[8];
int i = 1;
sql = "INSERT into TBL_LOGS VALUES(?,?,?,?,?,?,?,?)";
PreparedStatement ps = connection.prepareStatement(sql);
//ps.setString(i+1, fields[i]);
int rs = ps.executeUpdate();
subject: Before insert Trigger