How to Insert and sort the data at the same time using java : This is the sample code which I have written
```
    String sql =" INSERT INTO "+tablename+" (id,timestamp,type,current_num_workers,target_num_workers) 
    VALUES (?,?,?,?,?)";
    PreparedStatement pstmt=con.prepareStatement(sql);
	
	System.out.println("Fetching records in ascending order...");
	String se="SELECT * FROM " + tablename + " ORDER BY type ASC";
	PreparedStatement pstmt=con.prepareStatement(sql);
	
    pstmt.setString(1, id); 
	pstmt.setString(2, timestamp); 
	pstmt.setString(3, type); 
	pstmt.setString(4, current_num_workers); 
	pstmt.setString(5, target_num_workers);
	pstmt.executeUpdate();
	pstmt.executeUpdate();

```

This is the exception which I am facing
```
    Exception in thread "main" com.microsoft.sqlserver.jdbc.SQLServerException: A result set was 
    generated for update.
	at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(SQLServerException.java:226)
	at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatement
    (SQLServerPreparedStatement.java:592)
	at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PrepStmtExecCmd.doExecute
    (SQLServerPreparedStatement.java:508)
	at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:7240)
	at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:2869)
	at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(SQLServerStatement.java:243)
	at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(SQLServerStatement.java:218)
	at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.executeUpdate
    (SQLServerPreparedStatement.java:461)

```

Help me to resolve this and where I should sort and insert the details at the same time.

