????SQL???????????д?????????????????????????????????????????????????????£???ORACLE????????£?SQL????????????????????????????????????????????????????и?SQL????????SELECT?????????????????????н???????????????
????SQL??????й?????????£?
??????????PARSE??—— ????BIND??——??У?EXECUTE??——?????FETCH ???SELECT?????????
????????
?????????????????????SQL??????????????????????????SQL??????Ч???裬??Щ???豻?????м????
????Step 1????鹲?????????????????????SQL???????洢??SQL???????????????м???????????????????????????????????????м??????SQL??????????ν????????????????????????????????м????????????????????н?Σ???????????????????
???????????????????????????????????м????????????????SQL????????м????????????????????
?????????????????SQL?????????????????????????????????V$SQL????????????????????????

SQL>SELECT * FROM SCOTT.DEPT WHERE DEPTNO =10;
SQL>SELECT * FROM SCOTT.DEPT WHERE DEPTNO =20;
SQL> SELECT HASH_VALUE ?? ADDRESS?? EXECUTIONS ??SQL_TEXT
FROM V$SQL
WHERE SQL_TEXT LIKE 'SELECT * FROM SCOTT.DEPT WHERE DEPTNO%'
;
HASH_VALUE ADDRESS EXECUTIONS SQL_TEXT
---------- -------- ---------- --------------------------------------------------------------------------------
442836625 27EE4B7C 1 SELECT * FROM SCOTT.DEPT WHERE DEPTNO =20
4215405494 27EEA3BC 1 SELECT * FROM SCOTT.DEPT WHERE DEPTNO =10
???????????????????????????м?????????e???????????м????任
SQL> ALTER SYSTEM FLUSH SHARED_POOL;
System altered
SQL> VARIABLE deptno NUMBER;
SQL> EXECUTE :deptno := 10;
PL/SQL procedure successfully completed
deptno
---------
10
SQL> SELECT * FROM SCOTT.DEPT WHERE DEPTNO=:deptno;
DEPTNO DNAME LOC
------ -------------- -------------
10 ACCOUNTING NEW YORK
SQL> EXECUTE :deptno :=20;
PL/SQL procedure successfully completed
deptno
---------
20
SQL> SELECT * FROM SCOTT.DEPT WHERE DEPTNO=:deptno;
DEPTNO DNAME LOC
------ -------------- -------------
20 RESEARCH DALLAS
SQL> SELECT HASH_VALUE ?? ADDRESS?? EXECUTIONS ??SQL_TEXT
2 FROM V$SQL
3 WHERE SQL_TEXT LIKE ' SELECT * FROM SCOTT.DEPT WHERE DEPTNO%';
HASH_VALUE ADDRESS EXECUTIONS SQL_TEXT
---------- -------- ---------- --------------------------------------------------------------------------------
3669302979 27D2BA1C 2 SELECT * FROM SCOTT.DEPT WHERE DEPTNO=:deptno