What is difference between function and procedure?

Answer Posted / vijay

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 can not 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. 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 wont support deferred name resolution.

7.Stored procedure returns always integer value by default
zero. where as 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 ?    3 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain how you can delete excel file in qtp?

578


What is quicktest professional (qtp)?

550


How software tester can use constants and variables in scripts?

1669


in my application,validation message has in japanise language.how to validate this message is appears properly or not

1506


Explain how Does Run time data (Parameterization) is handled in QTP?

548






Is it possible to call win runner script in qtp?

613


what is error and fault in terms of software quality?

1445


how to use the QTP choose the data from oracle? e.g. i input the identity card NO. this will be add new record in the database ,and now i want get this record's prime key.

1305


What is the difference between the keyword view and expert view?

517


what is the latest version of QTP? Main difference between 9.2 and 10 version

1532


Is any limitation to xml checkpoints?

549


How to save your test using quicktest professional (qtp)?

579


What VBScript operators, functions, and statements do you use in QuickTest Professional?

2155


Can we access the java methods in qtp. Because my requirement is to access the swt(for eclipse an it is java code) methods in qtp is it possible?

1511


How to Open FireFox using descriptive programing? If my question is not clear, i will give an Example To Open Internet Explorer, We use Set IE = CreateObject(InternetExplorer.Application) IE.Navigate "www.yahoo.com In the same i need to open yahoo.com in firefox. Can any one tell me what is the server name of firefox to create an object

2512