GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Interview Questions  >  Oracle  >  SQL
Go To First  |  Previous Question  |  Next Question 
 SQL  |  Question 42 of 171    Print  
Difference between procedure and function.
Functions are named PL/SQL blocks that return a value and can be called with arguments procedure a named block that can be called with parameter. A procedure all is a PL/SQL statement by itself, while a Function call is called as part of an expression.



  
Total Answers and Comments: 13 Last Update: October 29, 2009   
  
 Sponsored Links

 
 Best Rated Answer
Submitted by: Abhineet Jindal
 
The main difference is DML (Data Manipulation). Through Stored procedure you can manipulate data i.e u can insert,update,delete records from table but in function u can't manipulate data. then comes secondary differences like function returns a value and stored procedures does not until and unless u specify an output parameter.stores procedure is a precomplied function i.e it has to be complied oly once but a function when called is complied again and again.

Above answer was rated as good by the following members:
agarwalshivani82, rituk_15
  Sorting Options  
  Page 1 of 2   « First    1    2    >     Last »  
November 10, 2005 03:07:22   #1  
Abhineet Jindal        

RE: Difference between procedure and function.
The main difference is DML (Data Manipulation). Through Stored procedure you can manipulate data i.e u can insert update delete records from table but in function u can't manipulate data. then comes secondary differences like function returns a value and stored procedures does not until and unless u specify an output parameter.stores procedure is a precomplied function i.e it has to be complied oly once but a function when called is complied again and again.
 
Is this answer useful? Yes | NoAnswer is useful 3   Answer is not useful 0Overall Rating: +3    
December 12, 2005 13:09:35   #2  
manju        

RE: Difference between procedure and function.

procedure performs an action

function computing a value


 
Is this answer useful? Yes | No
December 22, 2005 18:54:29   #3  
shyki8 Member Since: December 2005   Contribution: 1    

RE: Difference between procedure and function.
procedure perform action.in procedure a return statement can't contain an expressionfuncation computing a value.in function return statement must conain expression
 
Is this answer useful? Yes | No
August 01, 2006 06:45:43   #4  
SHIKHA        

RE: Difference between procedure and function.

One more diff is that function must return a value while procedure may or may not return a value


 
Is this answer useful? Yes | No
September 21, 2006 07:09:21   #5  
Mrunal        

RE: Difference between procedure and function.

One more difference is

Procedure can executed by writing exec(Procedure_name) But Functions are called in DML statements or a PL/SQL Block.


 
Is this answer useful? Yes | No
September 22, 2006 04:03:18   #6  
kuthuri Member Since: September 2006   Contribution: 1    

RE: Difference between procedure and function.
Functions are used for compute the business logic ***
 
Is this answer useful? Yes | No
November 02, 2006 11:50:49   #7  
thumatinagaraju        

RE: Difference between procedure and function.
hi manju both can perform same action but only diff iz procedure does't return a value n function directly returns a value....ok byeee
 
Is this answer useful? Yes | No
April 12, 2007 09:59:06   #8  
sayeed321in Member Since: April 2007   Contribution: 4    

RE: Difference between procedure and function.
Difference between functions and procedures:
1) DML is allowed in the function if it is not called from a DML (select) statement.but it is absolutely allowed when called from a procedure or a function which is not called from any DML

2) you can have a return statement in function where as procedure does not have return statement.

3) You can invoke a function from a DML.but the same is not possible with a procedure.


This is what the difference i feel.......If u know anything else then let me know.

 
Is this answer useful? Yes | No
April 12, 2007 14:38:46   #9  
irinak Member Since: December 2006   Contribution: 37    

RE: Difference between procedure and function.
Procedure does not return a Value but a Funtion return a Value.

SCOTT@LSC01> create or replace type tn is table of number;
2 /

Type created.

SCOTT@LSC01> create or replace function f return tn pipelined is begin null; end;
2 /

Function created.

SCOTT@LSC01> select * from table(f);

no rows selected

 
Is this answer useful? Yes | No
October 11, 2007 02:04:08   #10  
venkat        

RE: Difference between procedure and function.

We can perform DML statements in a function. But we can't call this function in a SELECT statement


 
Is this answer useful? Yes | NoAnswer is useful 0   Answer is not useful 1Overall Rating: -1    
  Page 1 of 2   « First    1    2    >     Last »  


 
Go To Top


 Sponsored Links

 
About Us -  Privacy Policy -  Terms and Conditions -  Contact -  Ask Question -  Propose Category -  Site Updates 

Copyright © 2005 - 2009 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape