• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Before insert Trigger

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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();
 
This tiny ad is guaranteed to be gluten free.
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic