First page Back Continue Last page Graphics
Bind Variables
“Executing SQL statements without bind variables is very much like compiling a subroutine before each and every … call”
- From Tom Kyte, expert one-on-one Oracle
Notes:
Bind variables are very, very important in Oracle application design because they promote shared pool reuse.
In the example shown above, the 1st two statements would be considered different because they incorporate literals instead of bind variables. Thus, each one will go through all parse steps – soft and hard parse – before execution.
The second example uses a bind variable. SQL*plus bind variables can be declared as shown below:
dave@CLASS2> var area_code char(3)
dave@CLASS2> exec :area_code := '212'
PL/SQL procedure successfully completed.
dave@CLASS2> select * from customer where area_code = :area_code;