SQL> alter session set events '10046 trace name context forever, level 12';
Session altered.
SQL> var v1 number;
SQL> begin :v1 := 1983; end;
2 /
PL/SQL procedure successfully completed.
SQL> select b from pin_test where b = :v1;
B
----------
1983
1983
SQL> begin :v1 := 1984 ; end;
2 /
PL/SQL procedure successfully completed.
SQL> select b from pin_test where b = :v1;
B
----------
1984
1984
SQL> begin :v1 := 1985 ; end;
2 /
PL/SQL procedure successfully completed.
SQL> select b from pin_test where b = :v1;
B
----------
1985
1985
SQL> exit
[TEST10]/lim/admin/TEST10/udump> tkprof test10_ora_13844.trc
output = lc_test.txt
TKPROF: Release 10.2.0.4.0 - Production on Sat May 12 02:12:27 2012
Copyright (c) 1982, 2007, Oracle. All rights reserved.
[TEST10]/lim/admin/TEST10/udump> vi lc_test.txt
********************************************************************************
select b
from
pin_test where b = :v1
call count cpu elapsed disk query current rows
------- ------ -------- ---------- ---------- ---------- ---------- ----------
Parse 3 0.00 0.00 0 0 0 0
Execute 3 0.00 0.00 0 1 0 0
Fetch 6 0.41 0.40 838 24990 0 6
------- ------ -------- ---------- ---------- ---------- ---------- ----------
total 12 0.41 0.40 838 24991 0 6
Misses in library cache during parse: 1
Misses in library cache during execute: 1
Optimizer mode: ALL_ROWS
Parsing user id: 58
Rows Row Source Operation
------- ---------------------------------------------------
2 TABLE ACCESS FULL PIN_TEST (cr=8330 pr=191 pw=0 time=33841 us)
Elapsed times include waiting on following events:
Event waited on Times Max. Wait Total Waited
---------------------------------------- Waited ---------- ------------
SQL*Net message to client 6 0.00 0.00
db file sequential read 207 0.00 0.00
db file scattered read 189 0.00 0.00
SQL*Net message from client 5 13.59 25.13
********************************************************************************
create table pin_test (b number);
begin
for i in 1 .. 1500000 loop
insert into pin_test (b) values ( i);
end loop;
commit;
end;
------------------------------------
*[Session 1]*
create or replace function pin_test_f
return number
is
v_rslt number ;
begin
select sum((q.b + t.b)/(q.b*t.b) + (q.b*t.b)/(q.b/t.b)) into v_rslt from
(select b from pin_test) q,
(select b from pin_test) t
where q.b=t.b+1;
return v_rslt;
end;
/
SQL> select pin_test_f from dual;
PIN_TEST_F
----------
1.1250E+18
SQL>
*[Session 2]*
SQL> alter table pin_test add (d number(5));
Table altered.
SQL> alter table pin_test modify b number(10);
Table altered.
SQL>
- 강좌 URL : http://www.gurubee.net/lecture/3098
- 구루비 강좌는 개인의 학습용으로만 사용 할 수 있으며, 다른 웹 페이지에 게재할 경우에는 출처를 꼭 밝혀 주시면 고맙겠습니다.~^^
- 구루비 강좌는 서비스 제공을 위한 목적이나, 학원 홍보, 수익을 얻기 위한 용도로 사용 할 수 없습니다.