How to optimize the following
Hi,
I have an update statement that uses 2 functions
update table_a set col3 = function1(col1,col2), col4 = function2(col1,col2);
Each function access the same table with the same where clause
create or replace Function function1 (p_OrderDate in date, p_DriverCode in varchar2)
RETURN varchar2
is
v_TruckCode varchar2(10);
BEGIN
SELECT skey_truck_code
INTO v_TruckCode
FROM (SELECT skey_driv_empl_code, typed_time, skey_truck_code, RANK() OVER (ORDER BY typed_time asc) typed_time_rank
FROM f_ticket
WHERE skey_order_date = p_OrderDate and skey_driv_empl_code = p_DriverCode)
WHERE typed_time_rank = 1;
update table_a set col3 = function1(col1,col2), col4 = function2(col1,col2);
Each function access the same table with the same where clause
create or replace Function function1 (p_OrderDate in date, p_DriverCode in varchar2)
RETURN varchar2
is
v_TruckCode varchar2(10);
BEGIN
SELECT skey_truck_code
INTO v_TruckCode
FROM (SELECT skey_driv_empl_code, typed_time, skey_truck_code, RANK() OVER (ORDER BY typed_time asc) typed_time_rank
FROM f_ticket
WHERE skey_order_date = p_OrderDate and skey_driv_empl_code = p_DriverCode)
WHERE typed_time_rank = 1;
0