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
What is the use of "New Property" in "Add properties" of testobject properties in object repository. How can i use "New properties" while writing scripts if i have assign some values to the testobject properties Can anyone help me? plz
How can you give wait up to 10 seconds in qtp?
The hybrid framework can be implemented for any application. Is it true?
In qtp, explain what is qrs file?
what is the mail use of frame work(with detail). architecture for keyword driven frame work
What is object spy in quicktest professional?
what kind of frame work you used in your last project?
What are the major/ important methods, functions in QTP we use realtime testing
In the Hybrid framework, data can access the database, excel file, XML etc. Is it true?
What are the common defects found in your project? (in qtp interview)
How will you test a keyboard?
How may types of defects identify application or your currently working application?pls give me answer..
Differences between quicktest professional (qtp) and winrunner?
hi guys we r working in office...we write some scripts..suddenly we have a work(5min only) in out side..what will do now,,,used to system shut down or log off or lock or sleep mode,switch use or hibernate?
how can i sent QTP results to the Html, notefile ,xl file give me the code using g mail login page