I need to create a oracle sql script (not stored procedure) which has some sql statements (process_audit sql statements) that are getting used more than once in the script.
Pseudo code of my oracle script:
begin
open cursor1
loop(1)
open cursor2
loop(2)
if codition1 then
process_audit sql statements;
else
sql statements;
end if;
end loop(2);
close cursor2;
end loop(1);
close cursor2;
process_audit sql statements;
end;
In Java/C we can create a function and put the reusable lines in it and then call the function wherever it is required. Can we do similar in oracle sql script? I cannot use function as I cannot create anything permanently in the database schema.