I have many stored procedures and functions in a folder. I have a batch file that loops over the .sql files in the folder and writes the file names to a single SQL file for execution. After this, the batch file executes the single file in SQLPlus. The problem that I am running into is the ordering of the creation of the stored procedures and functions. I am getting compilation errors because stored procedure C needs function A to execute, but stored procedure C is created before function A. Is there a way to get around this without ordering the stored procedures and functions? My assumption is no there’s not, but I want to be sure before I start ordering the scripts.
Share
You could load them then walk through the dependencies view to try to work out the correct order for next time, or just load them then recompile, but in fact the best way to work is with packages instead of standalone procedures and functions.
In that case you would create all of the package specifications first, then create the package bodies. They are separated into specification and body for exactly this reason.