what is difference between procedure and function,
procedure and trigger?

Answers were Sorted based on User's Feedback



what is difference between procedure and function, procedure and trigger?..

Answer / arup ratan banerjee

Procedure and Function
----------------------
1)Function return atleast one value
Procedure may or may not return value

2)Function can be a part of expression
Procedure can't be a part of exception

Procedure and Trigger
----------------------
Procedure need to be executed explicitly
Trigger gets automatically executed when insert update or
delete is fired on a table.



commit can be done in procedure
commit cannot be done in case of triggerrs except for
autonomous transactions

Is This Answer Correct ?    47 Yes 4 No

what is difference between procedure and function, procedure and trigger?..

Answer / roopesh kumar

Diff. B/W Procudure & Func......
(1) Proc. may or may not return value or more than one.
but func. must return a single value.
(2) We can call a func. in a select stmt. but func. should
only with IN parameter.
But we can't call a procedure inside a selct stmt.
because calling a procedure itself a PL/SQL block.

There is no too much diff. b/w proc. & func. but the thing
is that when we are looking to get back a single value we
should use func. in case of more than one then we should go
for proc.

Diff. b/w proc. & trigger..

(1) We have to call a proc. explicitly but trigger will
fire implicitly with assosiated event.

Is This Answer Correct ?    21 Yes 4 No

what is difference between procedure and function, procedure and trigger?..

Answer / ganesh ganjre

Diff. b/w proc. & trigger..
procedure can be called from trigger but trigger can't be
called from procedure.
Trigger(Implicitly)
Procedure(Explicitly)

Is This Answer Correct ?    14 Yes 1 No

what is difference between procedure and function, procedure and trigger?..

Answer / suresh somayajula

Difference between Procs & Triggers is;

We have control over the firing of Stored Proceudres,
but we don't have control over the firing of Database
Triggers.

Is This Answer Correct ?    12 Yes 3 No

what is difference between procedure and function, procedure and trigger?..

Answer / jagadesh

procedure can take parameters as argument's but triggers
cannot take parameters as arguments

Is This Answer Correct ?    7 Yes 2 No

what is difference between procedure and function, procedure and trigger?..

Answer / manish

PROCEDURE ARE NOTHING THEY R JUST STEPS OD DOING SOMETHING
PROGAMATICALLY...SO USE IT

Is This Answer Correct ?    1 Yes 1 No

what is difference between procedure and function, procedure and trigger?..

Answer / qx1789

he major difference to keep in mind is that trigger code is hard-parsed every time the trigger runs. You should therefore code all of your trigger actions in stored procedures (preferably implemented in packages, per good programming practice), and limit the trigger body to a PL/SQL block that just invokes the procedure. Learn sql from https://www.youtube.com/watch?v=7Vtl2WggqOg

Is This Answer Correct ?    0 Yes 0 No

what is difference between procedure and function, procedure and trigger?..

Answer / gvk

functions and procedures:
1.Functions Returns a value, procedure not return a value.
2.parsed & compiled at runtime, Procedure stored as a
pseudo code in database ie. Compiled form.
3.Cannot effect the state of database,sp effect the state
of database using Commit etc..
4.mainly used to compute the values, sp used to process the
tasks.
5.It can be invoked from sql statement :eg:select, sp can
not invoked.
6.it is not accept more than one argument.sp accept more
than one argument.

Trigger and procedure:

1.It is run Automatically , sp run it manually.
2.With in a trigger u can call the sp, with in a sp u can
not call the trigger.
3.when u r creating the trigger u have to identify event
and action of your trigger. not possible in sp.
4.Trigger not pass the arguments but sp pass the arguments.

Is This Answer Correct ?    1 Yes 3 No

Post New Answer

More SQL PLSQL Interview Questions

i have a table eno dno sal 1 10 200 2 10 150 3 10 100 4 20 75 5 20 100 i want to get sal which is less than the avg sal of thri dept. eno dno sal 2 10 150 3 10 100 4 20 75

12 Answers   IBM,


How do I run a sql script?

0 Answers  


What is the difference between sql and isql*plus?

0 Answers  


wt is the diff b/w greast and max ,least and min? wt is the diff b/w case and decod?

4 Answers   Oracle, TCS, Tecnics,


What is difference between TRUNCATE & DELETE?

16 Answers   Ahn Infotech, CitiGroup, ICICI, PreVator, Saama Tech, SkyTech, TCS,






How to add new employee details in an employee_details table with the following details

0 Answers  


What is the difference between an inner and outer join?

0 Answers  


Which join is default?

0 Answers  


Are sql database names case sensitive?

0 Answers  


What is left join in postgresql?

0 Answers  


What are analytic functions in sql?

0 Answers  


What is sql table?

0 Answers  


Categories