Updateable ResultSet just for doing inserts: good idea?
posted 14 years ago
I hate it when my INSERT statements become horribly long. One thing that would solve this is querying for an empty updateable resultset from the table i want to insert into, and then use the update methods to specify the values (after doing a moveToInsertRow) Is this a good idea, or does it have serious performance implications? / Jesper
I find that PreparedStatements clean up a long insert statement:
I'm not a big fan of scrollable/updateable resultsets, but you could query your table for an empty ResultSet: "select * from emp where 1=2"...then move to insert row...etc but I'm not sure if you can have a where clause on the resultset if you want to insert into it(some drivers/DB's throw exceptions)