This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes JDBC and the fly likes select/insert Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "select/insert " Watch "select/insert " New topic
Author

select/insert

Peter Straw
Ranch Hand

Joined: Jan 08, 2002
Posts: 79
Does anyone know a good way to move data from one table to another please?
The only one I can think of is to do a SELECT statement and then go through the ResultSet and for each result create an INSERT statement. Seems a bit long-winded...
Many thanks
clement valentine
Greenhorn

Joined: Apr 04, 2002
Posts: 19
I would do it outside the application (using sql) if there is not much transformation/business rules in moving from one table to another.
eg insert into A select * from B
Peter Straw
Ranch Hand

Joined: Jan 08, 2002
Posts: 79
thanks - using a runtime exec command?
Dana Hanna
Ranch Hand

Joined: Feb 28, 2003
Posts: 227
If you need to do it in the app, you'd be better off using JDBC, and the execute() method of Statement.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: select/insert
 
Similar Threads
Looks right to me
transfer data from one DB to another
sequence to a field
storing autogenerated value into variables in procedures
Oracle