What is difference between function and procedure?

Answer Posted / pranjal

Bot functions and procedures can return values. Apart from
this following are the differences

1) Functions are used for computations where as procedures
can be used for performing business logic

2) Functions MUST return a value, procedures need not be.

3) You can have DML(insert,update, delete) statements in a
function. But, you cannot call such a function in a SQL query..
eg: suppose, if u have a function that is updating a table..
you can't call that function in any sql query.
- select myFunction(field) from sometable; will throw error.

4) Function parameters are always IN, no OUT is possible

5) Function returns 1 value only. procedure can return
multiple values(max. 1024)

6) Stored Procedure :supports deffered name resoultion
Example while writing a stored procedure that uses table
named tabl1 and tabl2 etc..but actually not exists in
database is allowed only in during creation but runtime
throws error Function wont support deffered name resolution.
Stored procedure returns always integer value by default
zero. where as function return type could be
scalar or table or table values(SQL Server).
Stored procedure is pre compiled exuction plan where as
functions are not.

7) A procedure may modifiy an object where a function can
only return a value.

Is This Answer Correct ?    205 Yes 17 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Hi. please provide license key for QTP 9.2, I have windows XP on my machine Thanks in Advance, moreshwar

2801


Client is able to provide budget..he want you to choose the automation tool for the web application? which one you will select ? QTP or Selenium ? what are the reasons?

1229


How to do call a output parameter from one action to another action??/

1874


how to fetch the values from grid? & qtp recogniges that grid as a webelement? what u do?

1910


HI I want to know the detials of QTP certifications such as syllabus, study Materil etc. Can any provide me all these details?? my mail ID is krishnuvk@yahoo.com

1539






can any one please tell me which is the best institute in Bangalore to learn QA (crash course)? Thanks

1527


How are actions and functions different in QTP?

660


What is difference between run time object and test object?

558


Hi, my requirement is to make a query in SQL using QTP. And i have to get the results of that query and i have to use those results for future testing. I created a driver but i dont know the code for using this Driver. please help me by providing the solution for y requorement

1649


What is active screen?

566


how can we preform retesting(DATA driven test) using function please gine the code for loginpage

2278


How do you configure QTP AND Test director?

1502


before launching qtp, we need to close all the open browsers u dont know what are all the browsers either it might be ie,mozilla etc and u dont know how many brosers are open.... u need to close all these before launching qtp.. can anyone plz temme d solution...

7235


How do you compare the structure of 2 tables in database and check whether they are similar using qtp.

1478


what and how to answer for the question "tell me about yourself ?" for 3 years experience. can anyone say inj detail please... its urgent

1341