Professional Documents
Culture Documents
in literals:
The following query of V$SQLAREA shows that the three statements require three
different parent cursors. As shown by VERSION_COUNT, each parent cursor requires
its own child cursor.
use bind variables instead of literals. You bind the same values (101, 120, and
165) to the bind variable :emp_id, and then display the execution plans for each:
VAR emp_id NUMBER
-----------------------------------------------------------------------------------
--
| Id | Operation | Name |Rows|Bytes|Cost (%CPU)|
Time|
-----------------------------------------------------------------------------------
--
| 0 | SELECT STATEMENT | | | |2 (100)|
|
| 1 | SORT AGGREGATE | |1|8 | |
|
| 2 | TABLE ACCESS BY INDEX ROWID BATCHED| EMPLOYEES |1|8 | 2 (0)| 00:00:01
|
|* 3 | INDEX RANGE SCAN | EMP_EMP_ID_PK |1| | 1 (0)| 00:00:01
|
-----------------------------------------------------------------------------------
--
3 - access("EMPLOYEE_ID"<:EMP_ID)