SQL - Parameter (Bind | Substitution) (Marker | Variable)

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 Server

select *
from items
where item = @it;

Oracle


Powered by ComboStrap