Home » SQL & PL/SQL » SQL & PL/SQL » functions..
icon12.gif  functions.. [message #233233] Wed, 25 April 2007 04:50 Go to next message
Messages: 144
Registered: February 2007
Location: india
Senior Member


I have an update statement as follows

some_Ind = 0
and some_Ind = 1
and f_test(param1, param2) ='Y'

If i have say total 5 rows in tableA and the some_Ind is set to 1 for 2 rows.
Will this update stmt, call the funtion for all 5 rows ? and then update only the rows matching the condition?
Because i am expecting this update stmt to call the function for only the 2 rows which has the some_Ind as set but i get the message printed out 5 times for 5 rows but it updates only 2 rows.

Re: functions.. [message #233245 is a reply to message #233233] Wed, 25 April 2007 06:12 Go to previous message
Messages: 283
Registered: December 2006
Location: Netherlands
Senior Member
Oracle doesn't know what data you have in the rows. So it will have a look in all rows and check the condition and then decide whether to update or not.

If you have defined indexes oracle can decide to only look at the rows it needs.

(however....oracle will read as a minimum 1 block. 5 rows will probably be all in the same block. Oracle will then read 1 block (with all rows) into memory, and then see only the appropriate rows.
Previous Topic: plz help me in getting the query
Next Topic: using Outlook Calender with PL/SQL
Goto Forum:

Current Time: Mon Jul 24 02:22:34 CDT 2017

Total time taken to generate the page: 0.11115 seconds