An SQL prepared statement consists of a single
SELECT
, INSERT
,
UPDATE
, DELETE
, or
CALL
SQL statement and has parameters that are
bound to specified values.
Use the SQLPreparedStatement
object to create an SQL
prepared statement. Then, you can import, insert, update, or delete data
in the database. Also, you can call stored procedures. You import data
using the fetch
function. For other database
operations, you use the execute
function.
An SQL prepared statement enables you to improve performance by executing one SQL statement with different values instead of creating multiple SQL statements. Also, an SQL prepared statement improves security by binding specified values to parameters.
You can use SQL prepared statements with a JDBC database connection only.
SQLPreparedStatement | SQL prepared statement |
Import Data Using SQL Prepared Statement with Multiple Parameter Values
Import data using an SQL SELECT
statement by binding
multiple parameter values in a loop.
SQL Prepared Statement Error Messages
Address common errors when working with SQL prepared statements.