Databases with an execution plan cache like SQL Server and the Oracle database can reuse an execution plan when executing the same statement multiple times. It saves effort in rebuilding the execution plan but works only if the SQL statement is exactly the same.
If you put different values into the SQL statement, the database handles it like a different statement and recreates the execution plan.
1
If you put different values into the SQL statement, the database handles it like a different statement and recreates the execution plan.
1
SELECT first_name, last_name
FROM emp
WHERE empno = 20
When using bind parameters/variables to substitute the val you do not write the actual values but instead insert placeholders into the SQL statement. That way the statements do not change when executing them with different values.
instead of the 1 you can use the following statement
instead of the 1 you can use the following statement
SELECT first_name, last_name
FROM emp
WHERE empno = :empno
or
SELECT first_name, last_name
FROM emp
WHERE empno = &empno
or
SELECT first_name, last_name
FROM emp
WHERE empno = p_empno