The main purpose of a stored procedure is to allow for efficient reuse of code. It is a set of SQL statements that are stored in the database and can be called from other programs or applications.
For example, a stored procedure might be used to retrieve customer information from a database. The stored procedure can then be called from a web page, allowing the web page to display customer information without having to write the same code multiple times.