Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to call multiple functions one at a time

SravpremJul 2 2022 — edited Jul 3 2022

I have a function which is calling three more functions serially in it. Each function is taking 6 seconds of time to complete, so the main function is taking 18secs to complete. I want to optimize this process. instead of calling serially, is there any way to call all 3 functions one at a time?
Main function is written like this
create or replace function main_fun () return varchar2
as
a varchar2(2000);
b varchar2(2000);
c varchar2(2000);
begin
a := func1(); -- this is taking 6 sec to complete
b:= func2(); -- this is taking 6 sec to complete
c := func3(); -- this is taking 6 sec to complete
return (a||B||C);
end;

I have tried like below, but still, main function is taking 18 secs. It seems like though I'm calling all functions in one sql statement, Oracle executing each function one by one
begin
select func1(),func2(),func3()
into a, b, c
from dual;
return (a||B||C);
end;
we are using 12c Oracle DB

Comments
Post Details
Added on Jul 2 2022
2 comments
1,430 views