1. stored Procedure is PL/SQL blocks with parameters and to be stored in the database. It then can be run from any db client such as sqlplus, pro*c, jdbc ...
To create, use:
CREATE [OR REPLACE]
PROCEDURE procedure_name[(parameter[
...
BEGIN
executable statements
...
END;
To execute:
SQL>execute procedure_name
2. Triggers are blocks of code that execute automatically when certain events happen. User can not call the trigger directly
For example:
create trigger trgger_name
before insert or update or delete on <table>
begin
<statement>
end;
/
Main Topics
Browse All Topics





by: uTabPosted on 2004-04-23 at 10:03:14ID: 10901752
SQL: Trigger:
---
A trigger is a special kind of stored procedure which executes when
a database is changed for some reason.
---
A trigger is connected with some table, and as such its SQL content
will be executed when e.g. a row is inserted, updated, or deleted.
---
For example:
---
If you decide to change an amount (e.g. a salary) in a database table,
after that, your trigger (=stored procedure containing your SQL
statements) is automatically executed, causing e.g. automatically some
other tables (like expenses) to be updated accordingly.
Stored procedure:
---
A stored procedures is a parameterized query
(that is a query where you can exchange variable parts with your
own input data).
---
A stored procedure is similar to procedures and functions in other
computer languages.
Hopes this helps.