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
How do you store pictures in a database?
> 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?
How to convert csv to table in oracle?
How to create a temporary table in oracle?
How to count groups returned with the group by clause in oracle?
How to run create database statement?
How data locks are respected in oracle?
How many types of tables supported by oracle?
How can you tell how much space is left on a given file system and how much space each of the file systems subdirectories take-up?
ABOUT IDENTITY?
What is the use of aggregate functions in oracle?
What happens if variable names collide with table/column names?
What the is the diff between local index and global index. give some example.
In Oracle Clinical 4.5.0, can the VIEW_TEMPLATE_ID column in DATA_EXTRACT_VIEWS table contain NULL value?
What is a directory object?