10.20.2008

Difference between Host variable and Bind Variable

HOST VARIABLES:
  • Host variables are the key to communication between your host program and Oracle.
  • Typically, a precompiler program inputs data from a host variable to Oracle, and Oracle outputs data to a host variable in the program.
  • Oracle stores input data in database columns, and stores output data in program host variables.

BIND VARIABLES:
  • A host variable can be any arbitrary C expression that resolves to a scalar type. But, a host variable must also be an lvalue. Bind variables are used in SQL and PL/SQL statements for holding data or result sets.
  • They are commonly used in SQL statements to optimize statement perrformance.
  • A statement with a bind variable may be re-executed multiple times without needing to be re-parsed.
  • Their values can be set and referenced in PL/SQL blocks.
  • They can be referenced in SQL statements bind variable references should be prefixed with a colon