https://www.geeksforgeeks.org/advantages-and-disadvantages-of-using-stored-procedures-sql/
You are writing code that is surrounded by the database environment, you could also write the functionality in a programming language
There are pros and cons to the Stored Program approach which you must weigh against your situation