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

What is the parameterization?

555


can the activities of test case design be automated?

1432


How does qtp identify gui object?

562


Explain about Test Fusion Report of QTP?

587


After fixing the bug, the same bug is raising again and again in new builds what we have to do? That bug is high level bug.

5815






Hi, While recording a Jave based web application, its recording all my actions and the objects.And I have 5 WebEdit objects on the page and all are recorded. But while execution, at the 2 WebEdit object, its entering the value into the object (Its making a call to the AJAX, matching the value), when the control get out of this object the value is erased or cleared. Could anyone please help. I have recoreded 5 more scenarios where WebEdit is in the picture on different webpages and all are working fine. Here is my Script: Browser("Sign In").Page("Matching Workbench_3").WebEdit ("locationLookup").Set "0320 - SEATTLE-KM" Browser("Sign In").Page("Matching Workbench_3").WebEdit ("supplierNameLookup").Set "TRAMMO PETROLEUM INC" *** SupplierNameLookup is the object, which is haing an issue. And also I was using the SendString function, but it didnt work.

1736


Explain QTP using different development techniques ?

506


If we put all properties in mandatory and assistive list of Normal Identification, Do we still need Smart?

544


I have qtp 9.5 demo ver,I am not able to record the yahoo broeser.so anyone can tell me what setting i have to do in QTP for yahoo brower recording. why its not recognise the object of yahoo browser????

2122


Shall we add Local Repository to shared object repository,if yes,how we add

5611


What is Associate Repository in QTP 9.2 ?

579


If I give some thousand tests to execute in two days what do you do?

560


what could go wrong with test automation?

1483


What is the syntax for how to call one script from another?

535


What ate the Technologies supported by QTP?

614