For a client asking to port Oracle packages to postgres I have procedures of over 5K lines of code with some having like X cursors and 40 sub procedures on the inside. something like:
PROCEDURE procedure_name(var_name var_type, var_name var_type OUT)
CURSOR cursor_name
CURSOR cursor2_name
sub PROCEDURE sub_procedure_name(vars)
end sub_procedure_name(vars)
sub PROCEDURE sub_procedure_name(vars)
end sub_precodeure_name
--BEGINNING OF MAIN PROCEDURE
end main_procedure
Currently I'm taking every package, subdeviding every main procedure into its subprocedures in separate files.
however i have no clue about the final structure of the project in plpgsql.
I want to know if i can nest functions and procedures inside of procedures in plpgsql.