Table of Contents

About

A parameter is placeholder in a prepared statement where value of data is replaced at runtime (ie when the program is running).

It permits to reuse the same statement with different value. See SQL - Prepared Statement

A parameter can be:

  • positional (The values are given by order)
  • or name (The values are given by name)

Bind parameters cannot be used to define table, view or column names (the structure of an SQL statement should remain).

They are used in the where predicate parts

Example with the question mark ? ansi character used to mark the parameter

select columnName
from tableName
where 
   date_modified <= date(?,?,?,?) and
   foo = ?

Technology

Ansi

SQL - ANSI (American National Standards Institute) SQL (Standard|Reference|Specification) - SQL (92|99|2003|2011)

select *
from items
where item = ?;

SQL Server

select *
from items
where item = @it;

Oracle

select *
from items
where item = :it ;

See also: