|
|
бет | 27/76 | Дата | 06.02.2022 | өлшемі | 0,67 Mb. | | #79506 | түрі | Лекция |
| - //создание таблицы
- String createString="CREATE TABLE
- "+name_of_massive+
- " ( NUMBER int generated by default as identity
- (START WITH 1, INCREMENT BY 1), "+
- "w0 DOUBLE )";
- Statement stmt = conn.createStatement();
- stmt.executeUpdate(createString);
- for(int i=1; i< number_of_columns; i++) {
- //добавление столбцов в таблицу
- String stradd="ALTER TABLE "+name_of_massive+
- “ADD"+"w"+String.valueOf(i)+" DOUBLE";
- stmt.executeUpdate(stradd); }
for(int j=0;j - for(int j=0;j
- //добавление строк в таблицу
- String str_query="insert into “
- +name_of_massive+" ( w0 )"+
- " values "+"( ?)";
- PreparedStatement psInsert =
- conn.prepareStatement(str_query);
- psInsert.setDouble(1,0.0);
- psInsert.executeUpdate();}}
- catch (Exception e) {
- System.out.println("In function createMas");
- e.printStackTrace();} }
Достарыңызбен бөлісу: |
|
|