aspose file tools*
The moose likes JDBC 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
Bookmark "Before insert Trigger" Watch "Before insert Trigger" New topic
Author

Before insert Trigger

Ann Bar
Greenhorn

Joined: Apr 04, 2006
Posts: 4
Hi,

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?

Thanks.

String fields[] = new String[8];
int i = 1;
sql = "INSERT into TBL_LOGS VALUES(?,?,?,?,?,?,?,?)";
PreparedStatement ps = connection.prepareStatement(sql);
//loop
//ps.setString(i+1, fields[i]);
int rs = ps.executeUpdate();
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Before insert Trigger
 
Similar Threads
how to insert 2 values togther in db?
INSERT
How Do I Insert .... ?
Iteration
Auto Increment ID Field Table in the Oracle Database