UrbanPro
true

Learn SQL Programming from the Best Tutors

  • Affordable fees
  • 1-1 or Group class
  • Flexible Timings
  • Verified Tutors

Search in

Difference Between Stored Procedure And Function

KJ Vinod Kumar
06/02/2018 0 0

Stored Procedures

Functions

Stored procedures may or may not return a value

Function should return a value

Stored procedure should be executed by ‘EXECUTE’ command.

Functions should execute by using ‘SELECT’ statement.

It will allow DML (Insert ,Update,Delete) operations.

It won’t allow DML (Insert ,Update,Delete) operations

Store Procedure Can allow Input and Output (Upto 24000)parameters.

Function Can allow Input parameters(Up to1200),

it won’t support for output parameters.

For exception handling we can use ‘Try catch blocks’. We can Perform Error handling Using StoreProcedures.

We cant Perform error handling inside a Function.

Inside a stored procedure we can call all types of ‘Data types’

Inside a function we can’t call ‘Text,Ntext,Image’ data types.

In stored procedure we can call any of the SQL objects like tables, temporary tables, sub queries Etc…

We can’t use Temporary tables inside a function

We can’t  create Triggers and Views inside a stored procedures.

We can’t use Views  inside a function

We can call functions and Child stored procedures (32) inside a stored procedures.

We can’t call stored procedures inside a functions.

Code reusability available in stored procedures.

Code reusability not available in functions.

Stored procedures will prefer Differ name resolution.

Differ name Resolution will not be applicable for functions.

After creating a Stored procedures, it will  create an execution plan.

Function won’t create any execution plans.

Stored procedures can’t be used in Join clause

Function can be used in join clause as a result set.

We can use Table variables inside a Stored procedures.

Here also we can use Table variables inside a Functions.

 

0 Dislike
Follow 2

Please Enter a comment

Submit

Other Lessons for You

Database Origins
The need for a database originates from the fact that computers are dumb devices having batman like abilities which can be smartly be utilised by feeding it the right content. That is, for example, consider...
M

Virtual (Derived) Column: Oracle 11g R1 (Part 1)
VIRTUAL OR DERIVED COLUMN A nice feature introduced in Oracle 11gR1. Welcome to the practical analysis of various scenarios with virtual columns - introduced in 11gR1 are like normal table columns whose...

Database Normalization
Database Normalization is the process of reducing duplication in database by decomposing the table1. Normal Form (1NF): Every attribute is atomic, Each cell to be single valued No multivalued attribute:...

SQL Tips (1 to 3)
SQL tip 1: Instead of Full Outer Join, you can use Union All. Difference is, Full Outer Join provides results side by side. Union All provides result s one by one. Note: MYSQL does not support Full...

Derived Tables
Following are the signs those qualify a query to be a derived table: These are defined in FROM clause of an outer query. It is surrounded by parenthesis followed by AS clause to define the derived...
X

Looking for SQL Programming Classes?

The best tutors for SQL Programming Classes are on UrbanPro

  • Select the best Tutor
  • Book & Attend a Free Demo
  • Pay and start Learning

Learn SQL Programming with the Best Tutors

The best Tutors for SQL Programming Classes are on UrbanPro

This website uses cookies

We use cookies to improve user experience. Choose what cookies you allow us to use. You can read more about our Cookie Policy in our Privacy Policy

Accept All
Decline All

UrbanPro.com is India's largest network of most trusted tutors and institutes. Over 55 lakh students rely on UrbanPro.com, to fulfill their learning requirements across 1,000+ categories. Using UrbanPro.com, parents, and students can compare multiple Tutors and Institutes and choose the one that best suits their requirements. More than 7.5 lakh verified Tutors and Institutes are helping millions of students every day and growing their tutoring business on UrbanPro.com. Whether you are looking for a tutor to learn mathematics, a German language trainer to brush up your German language skills or an institute to upgrade your IT skills, we have got the best selection of Tutors and Training Institutes for you. Read more