One of the optimizations behind the DETERMINISTIC keyword is that Oracle caches previously computed values. If you pass the same values into the function twice, the function body will execute at least once and at most twice. You can NOT count on the function body being executed for each call.
This is actually a cool feature. Consider a situation where you are repeatedly performing time-consuming computations/lookups. If Oracle caches previously computed values for you, this can lead to significant performance benefits! Kevin T -----Original Message----- Sent: Friday, October 03, 2003 9:51 AM To: Multiple recipients of list ORACLE-L As far as I know, with all current releases of Oracle, determinism is purely for function based indexes. The deterministic keyword indicates that the function values when you created the index are still preserved when you query it. Thus the "first" execution was during index creation, and the "second" execution is during subsequent queries during which the function does not need to be executed because it is deterministic. (Lame eh?) --- "Khedr, Waleed" <[EMAIL PROTECTED]> wrote: > drop table test_det; > create table test_det (c1 date); > create or replace function f2 (p1 in number, p2 in > number) return number > deterministic is > pragma autonomous_transaction; > begin > insert into test_det values (sysdate); > commit; > return(p1 * p2); > end; > / > select f2 (1,3) from dual where f2 (1,3) = 3; > F2(1,3) > ---------- > 3 > select * from test_det; > C1 > --------- > 02-OCT-03 > 02-OCT-03 > It did not save an execution even in the same sql > call! > Oracle 9.2.0.2 Solaris 2.8 > Regards, > > Waleed > > -- > Please see the official ORACLE-L FAQ: > http://www.orafaq.net > -- > Author: Khedr, Waleed > INET: [EMAIL PROTECTED] > > Fat City Network Services -- 858-538-5051 > http://www.fatcity.com > San Diego, California -- Mailing list and web > hosting services > --------------------------------------------------------------------- > To REMOVE yourself from this mailing list, send an > E-Mail message > to: [EMAIL PROTECTED] (note EXACT spelling of > 'ListGuru') and in > the message BODY, include a line containing: UNSUB > ORACLE-L > (or the name of mailing list you want to be removed > from). You may > also send the HELP command for other information > (like subscribing). ===== Connor McDonald web: http://www.oracledba.co.uk web: http://www.oaktable.net email: [EMAIL PROTECTED] "GIVE a man a fish and he will eat for a day. But TEACH him how to fish, and...he will sit in a boat and drink beer all day" ________________________________________________________________________ Want to chat instantly with your online friends? Get the FREE Yahoo! Messenger http://mail.messenger.yahoo.co.uk -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: =?iso-8859-1?q?Connor=20McDonald?= INET: [EMAIL PROTECTED] Fat City Network Services -- 858-538-5051 http://www.fatcity.com San Diego, California -- Mailing list and web hosting services --------------------------------------------------------------------- To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing). -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Kevin Toepke INET: [EMAIL PROTECTED] Fat City Network Services -- 858-538-5051 http://www.fatcity.com San Diego, California -- Mailing list and web hosting services --------------------------------------------------------------------- To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).
