Home » SQL & PL/SQL » SQL & PL/SQL » Triggers
Triggers [message #37105] Thu, 17 January 2002 20:29 Go to next message
Elavarasan
Messages: 7
Registered: January 2002
Junior Member
Hi all,

I would like to write a BEFORE INSERT trigger for table A.

This trigger should check whether the newly entered row already exist in the table. If it exist, it should return without doing anything. else it should insert the new row into the table A.
I.e

If newrow.patient_id = old.patient_id then
do nothing and return
else
insert the new row

How to write a trigger for the above scenario. Need your help.

Thanks in advance.
Rgds
Elav
Re: Triggers [message #37107 is a reply to message #37105] Thu, 17 January 2002 21:12 Go to previous messageGo to next message
Dmitri Lipodat
Messages: 8
Registered: January 2002
Junior Member
Hi Elav
Try to use VIEW and INSTEAD OF trigger
Re: Triggers [message #37109 is a reply to message #37105] Fri, 18 January 2002 00:13 Go to previous message
pratap kumar tripathy
Messages: 660
Registered: January 2002
Senior Member
Hi,

U need not write trigger, you can do it by creating primary key/unique key/unique index.

hope it helps!!!

cheers
pratap
Previous Topic: IN/OUT/INOUT PL-SQL arguments from Perl
Next Topic: what's wrong with this syntax
Goto Forum:
  


Current Time: Fri Aug 14 23:59:15 CDT 2020