import java.sql.*;public class Bestellung { public static void main (String [] args) throws SQLException { try { Class.forName ("oracle.jdbc.driver.OracleDriver"); Connection c = DriverManager.getConnection( "jdbc:oracle:thin:@..:1521:..", "", ""); Statement s = c.createStatement(); ResultSet rs = s.executeQuery( "SELECT menge,preis,posnr FROM Bestellposition"); Statement a = c.createStatement(); ResultSet ra = a.executeQuery( "SELECT bestnr, bestsum FROM Bestellung"); while (rs.next()) { int[] bnr = new int10000]; int i=0, j=0; double [] summe = new double[10000]; String erg; bnr [i] =rs.getInt(1); summe [i]= (rs.getInt("menge")* rs.getDouble("preis")); erg= "" + summe[i]; for (j=0; j<i; j++) { if (bnr[i]== bnr[j]) { summe[i]+= summe[j]; } String sl ="UPDATE Bestellung SET bestsum=?, bestnr=?"; PreparedStatement p = c.prepareStatement(sl); p.setString(1, "erg"); p.setString(2, "bestnr"); p.executeUpdate(); } System.out.println (rs.getString ("bestnr")+ "\t" + rs.getString ("menge")+ "\t" + rs.getString ("preis")+"\t" + rs.getString ("posnr"));}//end while c.close();}//end try catch (Exception e) { e.printStackTrace(); } }//end main}//end Bestellung