What is difference between function and procedure?

Answer Posted / gunesh

1.Function is mainly used in the case where it must return
a value. Where as a procedure may or may not return a value
or may return more than one value using the OUT parameter.
2.Function can be called from sql statements where as
procedure cannot be called from the sql statements.
3.Functions are normally used for computations where as
procedures are normally used for executing business logic.
4.You can have DML (insert, update, delete) statements in a
function. But, you cannot call such a function in a SQL
Query.
5.A Function returns 1 value only. Procedure can return
multiple values (max 1024).
6.Stored Procedure: supports deferred name resolution.
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 won’t support deferred name
resolution.
7.Stored procedure returns always integer value by default
zero. whereas function return type could be scalar or table
or table values
8.Stored procedure is precompiled execution plan where as
functions are not.
9.A procedure may modify an object where a function can
only return a value The RETURN statement immediately
completes the execution of a subprogram and returns control
to the caller.

Is This Answer Correct ?    13 Yes 6 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Where is the resultset of a sqlquery (which is fired by rsobj.open sqlquery,xxxx,xxxx) stored ?

1838


Explain features of the latest version of qtp/ uft 12.1?

574


What are the methods used in UFT to handle exceptions or run-time errors?

610


How to test the login page in different ways in automation testing and i need code?

1318


Whether qtp 9.0 supports Test director8.0

2100






what kind of frame work you used in your last project?

1790


Explain qtp(quick test professional)?

546


How to create a standard checkpoint ?

536


Hi Friendss..., can any body help me.. 1. Tell me your achievements(Technically)..? 2. Tell me your strengths(Technically) and weakness(Technical)..? 3. Why are you looking for change..?

1396


write the vb script for call to new action in qtp?

1824


When you open QTP, how many sheets you can see?

623


How to run an integrated test scenario using Multiple Actions? How to use the QTP Step Generator?

3416


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

2241


What are the different types of functions available in qtp and explain ?

546


How to handle the exceptions using recovery secnario manager in quicktest professional?

596