Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
// prepare both statments
PreparedStatement firstStatement = con.prepareStatement( "SELECT field1, field2 FROM some_table WHERE some_identifier=?" );
PreparedStatement secondStatement = con.prepareStatement( "INSERT INTO some_other_table VALUES(?,?)" );
// execute the SELECT query (the oneToGet variable is just an example)
int oneToGet = 10;
firstStatement.setInt( 1, oneToGet );
ResultSet rs = firstStatement.executeQuery();
// for each row retrieved
while( rs.next() ) {
// load values into the INSERT statement and execute
secondStatement.setInt( 1, rs.getInt( 1 ) );
secondStatement.setString( 2, rs.getString( 2 ) );
secondStatement.execute();
}
ps = con.prepareStatement( "
INSERT INTO t2 (c1, c2) VALUES AS
SELECT f1, f2
FROM t1
WHERE f3=?"
);