Spring: Developing Java Applications for the Enterprise
by Ravi Kant Soni, Amuthan Ganeshan, Rajesh RV
Calling a stored procedure
A stored procedure is a group of transact SQL statements. If you have a situation where you write the same query over and over again, then you can save that specific query as a stored procedure and call it just by calling its name. Stored procedures are a block of SQL statements that are stored as basic objects within your database.
Let's take our Employee table that has columns as EmpId, Name, and Age. Let's say that we need the name and age of an employee, we will write the query as Select Name, Age from employee. So every time we need the name and age of the employee, we will need to write this query. Instead, we can add this query to the stored procedure and call that stored procedure rather than writing this query ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access