what is difference between procedure and function
Answers were Sorted based on User's Feedback
Answer / p.rajasekar
Function:
1.Function Always Return values
2.We can call the function in select Query
3.We can return more than one values using Out put
paramaetes
4.Genrally we can use function as calculatevalues
5.We can insert,update or delte value with the help
function in a select query
Procedure:
1.Procedure doesnot always return value
2.We can't call procedure in Select query
3.We can return more than one value using Out put
parameters in procedure
4.Genarally procudures are using as business logic
| Is This Answer Correct ? | 6 Yes | 0 No |
Answer / a.jyothsna
1) function can be executed using the sql command
(Ex: select functin_name(args)from dual;)
Procedure can be executed using sql+ command
(Ex: exec procedure_name(args))
| Is This Answer Correct ? | 3 Yes | 0 No |
Answer / suresh
Function is return the value
procedure is not return the value
| Is This Answer Correct ? | 5 Yes | 3 No |
Answer / monalisa dalbehera
Function always return a single value
Procedure may or may not return a value.
A procedure can return more than one value by using out
parameter.
| Is This Answer Correct ? | 2 Yes | 0 No |
Answer / nannesaheb chinthalacheruvu
Procedure :
->Procedure is a Named PL/SQL Block which can be stored in
Database in compile form.
->Procedure is used to execute the Perticular task.
->Procedure Does not required RETURN clause.
->Procedure Does not Return value
->It is not posible to execute using SQL statements.
->Procedures can be execute using a)Execute/Call,b)Anonymous
Block
Function :
->Function is a Named PL/SQL Block Which can be Stored in
Database in Compile Form.
->Function is used for Calculation Perpose.
->Fuction Does Contains RETURN Type
->Fuction Can Return only One Value.
->Fuction can Execute using SQL Statements when We can not
Perform any DML Operations in Function.
->Using Out Mode Parameters we can Return Multiple Records
in Function.
| Is This Answer Correct ? | 2 Yes | 0 No |
Answer / shanmukha srinivas
procedure can run in sql block like
begin
sp_procedure_name(input parameters);
end;
function can run in sql block like
select sf_function_name(input paramters)
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer / aditi yadav
in addition to above answers -
1. Functions can be called inside procedure but procedure cannot be called inside functons.
2. Functions compiled every time when we call them whereas procedure compiles only once & can be called again and again without being compiled.
3. we can user functions in select statement but cannot use procedure.
4. Inside function we cannot user DML commands but inside procedures we can use DML commands.
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer / subhendu
Functions called from SQL have special restrictions:
Accept only IN parameters
cannot contain DML
cannot contain DDL - implies COMMIT
Accept and return only SQL datatypes (not PL/SQL
specific datatypes)
Must use positional notation
Must own or have EXECUTE privilege
Cannot contain transactional or session control
statements (eg. COMMIT, ROLLBACK, ALTER)
| Is This Answer Correct ? | 0 Yes | 2 No |
Answer / shyam katwal
The only difference between procedure and function is:
Function returns a value
whereas
Procedure does not return a value
| Is This Answer Correct ? | 0 Yes | 2 No |
Answer / k.sharada
procedure returns a value and function do not.
| Is This Answer Correct ? | 0 Yes | 4 No |
How do I run a sql query?
How do you write a subquery?
What are inner outer left and right joins in sql?
1. how to use the check option constraints in sql query..? 2.how to add data in a complex query ? 3.is it possible to use commit or rollback or savepoint in triggers...if not why please explain with examples...? 4.what is the difference between meterialized view and normal view..how to create materialized view and how to use it..? 5.what is varray...? what is the advantage of the varray ? please expalin with a simpel example..i want to load into a table (student no and name and his marks..) please give example.. 6.what are the bulk bind exceptions...how to use bulk bind and how to use bulk collect..please explain with example... 7.what is for update of and where current of ...? 8 what is the use of nowait ? 9.please give an example for nocopy in a simple plsql query 10.create an index in a table...tellme how to use the index in a where clause to do performance tunning...
C. Normalize the following data up to the 3rd Normal form. Create the tables and insert the data given. Emp_ID Name Dept_Name Salary Course_Title Date_Completed 100 Adam Marketing 48,000 SPSS 6/19/2008 Surveys 10/7/2008 140 Bob Accounting 52,000 Tax Acc 12/8/2008 110 Cathy IT SQL Server 1/12/2008 C# 4/22/2008 190 Dan Finance 150 Emily Marketing 55,000 SPSS 6/16/2008 42,000 Analysis 8/12/2008 Queries 1. Find all Names who have completed the SPSS Course. 2. Find employee with max salary. 3. Find employee with 2nd max salary. 4. Find all employees in Dept “Marketing”. 5. Find all the employees who have taken more than 2 courses. 6. Find all the employees who have completed the courses before month of September.
what is the difference difference between procedure and packages
2 Answers 3i Infotech, Oracle,
what are the advantages a stored procedure? : Sql dba
Difference between table function and pipelined function?
What is a string data type in sql?
What is left inner join in sql?
What are stuff and replace function?
What is a schema in sql?
Oracle (3259)
SQL Server (4518)
MS Access (429)
MySQL (1402)
Postgre (483)
Sybase (267)
DB Architecture (141)
DB Administration (291)
DB Development (113)
SQL PLSQL (3330)
MongoDB (502)
IBM Informix (50)
Neo4j (82)
InfluxDB (0)
Apache CouchDB (44)
Firebird (5)
Database Management (1411)
Databases AllOther (288)