What is difference between function and procedure?
Answer Posted / santosh(ssit)
Both 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 ? | 0 Yes | 0 No |
Post New Answer View All Answers
can i change the runtime properties of an object ? How can i check if a parameter exists in database ?
what are the utilities and drivers
What is the meaning Work bench?
What is object repository in qtp?
Analyzing the checpoint results?
Does QTP have any limitations?Can it work with all kinds of programming languages like java,springs,ajax ,hybernet?Also does it work well with windows 7.What are its other limitations
How to Upgrade or support firefox 2.0 version on QTP 9.0? I have installed QTP 9.0 and installed firefox 2.0. But in REcord and Run Settings, it shows firefox 1.5 in Web tab for browser selection.
How many types of recording modes in qtp? Which will be used when?
What are the different types of recovery operation?
Want to verify notepad reports using QTP framework or any other BV script method. Can anyone share the method to achieve it? Eg. Person Name is the header and the actual name is John then how can we verify weather person name is John
If you giving priority as p0, as a developer if I give priority as p2, What happens In user defined function ?
How many number of actions possible in qtp?
diff between qtp versions from 8.5
How many tabs are available to view your test in a test pane and what are they?
Where to use function or action?