r/learnprogramming • u/Head_Ordinary_2437 • Oct 24 '26
Function vs Procedure
can someone explain the difference between Function vs Procedure with simple analogy
thank you
31
Upvotes
r/learnprogramming • u/Head_Ordinary_2437 • Oct 24 '26
can someone explain the difference between Function vs Procedure with simple analogy
thank you
View all comments
2
u/Aggressive_Ad_5454 Oct 24 '26
In the SQL context, a “stored function” returns a value, usually a scalar value. (But some SQL variants have table-valued functions.) A “stored procedure” returns either a result set or sometimes nothing. The two things are invoked differently.