A prepared statement is an SQL statement that is pre-compiled by the database.
Through pre-compilation, prepared statements improve the performance of SQL commands that are executed multiple times.
Once compiled, prepared statements can be customized prior to each execution by altering predefined SQL parameters.
Example
PreparedStatement pstmt = connection.prepareStatement(
"UPDATE EMP SET SALARY = ? WHERE ID = ?");
pstmt.setBigDecimal(1, 153833.00);
pstmt.setInt(2, 110592);
No comments:
Post a Comment
Note: only a member of this blog may post a comment.