Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Trigger

Re: Trigger

From: M. Armaghan Saqib <armaghan_at_yahoo.com>
Date: Wed, 15 Mar 2000 07:53:17 GMT
Message-ID: <8anfhb$51f$1@nnrp1.deja.com>


Using my freeware you can generate templates for all database objects. This
is a highly recommended tools for people starting to learn Oracle.

Using its BLDTRG command, I could generate trigger code for table EMP as follows.

SQL> EXEC S2.BLDTRG('EMP')
| ----------------------------------------------------------------------



-
| CREATE OR REPLACE TRIGGER bs_emp
| --
| -- 1. BEFORE/STATEMENT trigger
| --
| BEFORE INSERT OR UPDATE OR DELETE
| ON emp
| BEGIN
| IF INSERTING THEN
| NULL;
| END IF;
| IF UPDATING THEN
| NULL;
| END IF;
| IF DELETING THEN
| NULL;
| END IF;
| END; -- Trigger: bs_emp
| /
|

| CREATE OR REPLACE TRIGGER br_emp
| --
| -- 2. BEFORE/ROW trigger
| --
| BEFORE INSERT OR UPDATE OR DELETE
| ON emp
| FOR EACH ROW
| BEGIN
| IF INSERTING THEN
| NULL;
| END IF;
| IF UPDATING THEN
| NULL;
| END IF;
| IF DELETING THEN
| NULL;
| END IF;
| END; -- Trigger: br_emp
| /
|

| CREATE OR REPLACE TRIGGER ar_emp
| --
| -- 3. AFTER/ROW trigger
| --
| AFTER INSERT OR UPDATE OR DELETE
| ON emp
| FOR EACH ROW
| BEGIN
| IF INSERTING THEN
| NULL;
| END IF;
| IF UPDATING THEN
| NULL;
| END IF;
| IF DELETING THEN
| NULL;
| END IF;
| END; -- Trigger: ar_emp
| /
|

| CREATE OR REPLACE TRIGGER as_emp
| --
| -- 4. AFTER/STATEMENT trigger
| --
| AFTER INSERT OR UPDATE OR DELETE
| ON emp
| BEGIN
| IF INSERTING THEN
| NULL;
| END IF;
| IF UPDATING THEN
| NULL;
| END IF;
| IF DELETING THEN
| NULL;
| END IF;
| END; -- Trigger: as_emp
| /

|

regards,
M. Armaghan Saqib

+---------------------------------------------------------------

| 1. SQL PlusPlus => Add power to SQL Plus command line
| 2. SQL Link for XL => Integrate Oracle with XL
| 3. Oracle CBT with sample GL Accounting System
| Download free: http://www.geocities.com/armaghan/
+---------------------------------------------------------------

| SQLPlusPlus now on http://www.ioug.org/
| "PL/SQL package that extends SQL*Plus to another dimension.
| Contains a PL/SQL code generator and set of extremely useful
| utilites with extensive documentation." IOUG Web Site
+---------------------------------------------------------------

<leokim_at_my-deja.com> wrote in message
news:8alklc$qpf$1_at_nnrp1.deja.com...

> Hello,
> Could anyone give me a tip or two to create trigger in ORACLE? syntax
> will help too. My background is in Sybase.
> Thanks
> Leo
>
>
> Sent via Deja.com http://www.deja.com/

> Before you buy.



Sent via Deja.com http://www.deja.com/
Before you buy. Received on Wed Mar 15 2000 - 01:53:17 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US