What are main difference between Stored Procedure and
Functions.

Answer Posted / hemanth

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)We can call a function from a procedure, but it is not
possible to call a procedure from a function

Is This Answer Correct ?    6 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the restrictions on external table columns?

547


How many memory layers are in the oracle shared pool?

637


Why use resource manager in Oracle?

661


What do you understand by database schema and what does it hold?

590


How will you write a query to get a 5th rank student from a table student_report?

1370






How to retrieve data from an cursor to a record?

559


What is oracle in java?

524


How to rebuild an index in oracle?

546


How to create a temporary table in oracle?

688


Explain drop constraint oracle?

589


> CREATE OR REPLACE FUNCTION FACTORIAL_1(factstr varchar2 ) 2 RETURN NUMBER AS 3 new_str VARCHAR2(4000) := factstr||'*' ; 4 fact number := 1 ; 5 BEGIN 6 7 WHILE new_str IS NOT NULL 8 LOOP 9 fact := fact * TO_NUMBER(SUBSTR(new_str,1,INSTR(new_str,'*')-1)); 10 new_str := substr( new_str,INSTR(new_str,'*')+1); 11 END LOOP; 12 13 RETURN fact; 14 15 END; explanation Above program?

1565


Give the different types of rollback segments.

578


What is translate in oracle?

615


What are the system predefined user roles?

585


22. Display the order number, number of lines in the order, total number of items and total value for all orders that have a total value greater than $100

1602