It is one among the fundamental thought in the computer programming. It is used to calculate something from a given input. Hence it got its name from Mathematics. Function can be either user defined or predefined. The function program has a block of code that performs some specific tasks or functions.
In programming a particular set of instructions or commands along known as a procedure. Counting on the programming language it is known as as procedure, subroutine, function or a subprogram.
Difference between Function and Procedure:
|1.||A function deals with as an expression.||Whereas a procedure does not deal with as an expression.|
|2.||Function is used to calculate something from a given input. Hence it got its name from Mathematics.||While procedure is the set of commands, which are executed in a order.|
|3.||The function can be called by a procedure.||But a procedure can not be called by a function.|
|4.||In sql, inside the function we can not use the DML(Data manipulation language) commands such as Insert, Delete, Update.||Here, in sql, inside the procedure we can use DML commands.|
|5.||Functions can be called through sql queries.||However, the procedure can’t be called through a sql query.|
|6.||Each time functions are compiled when they are called.||Whereas, procedures are compiled only once and can be called again and again as needed without being compiled each time.|
|7.||The return statement of a function returns the control and function’s result value to the calling program.||While the return statement of the procedure returns control to the calling program, it can not return the result value.|
|8.||Function doesn’t support try-catch blocks.||While it supports try-catch blocks.|
|9.||Function can be operated in the SELECT statement.||While it can’t be operated in the SELECT statement.|
|10.||Function does not support explicit transaction handles.||While procedure supports explicit transaction handles.|
- Difference between Method and Function in Python
- What is the difference between a language construct and a “built-in” function in PHP ?
- Difference between Virtual function and Pure virtual function in C++
- Difference between LED and LCD
- Difference between CPU and GPU
- Difference between C and C++
- Difference between ELT and ETL
- Difference between LAN, MAN and WAN
- Difference between ++*p, *p++ and *++p
- Difference between LAN and MAN
- Difference Between BFS and DFS
- Difference between MAN and WAN
- What is the difference between GUI and CUI?
- Difference between CRT and LCD
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.