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

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

Re: Trigger syntax

From: Chris <chrisben_at_iname.com>
Date: Fri, 03 Aug 2001 12:16:06 GMT
Message-ID: <kb5lmtgt6822255grrh23hacmko982eki2@4ax.com>

>Please clarify: how can you increment a sequence in table 1 (and obviously
>you need a record for that!) if the corresponding record doesn't exist?

Apologies if my description was unclear.

tab1
===

P_ID	NOT NULL	NUMBER(10)	
SEQ			VARCHAR2(9)

.....

tab2


ID	NOT NULL	NUMBER(10)	
P_ID	NOT NULL	NUMBER(10)
FIELD1			VARCHAR2(9
FIELD2			VARCHAR2(9

.....

tab1 and tab2 are joined on P_ID. A person can only appear once in tab1 but may appear many times in tab2.

So, if a new row is interted in tab2, I want the trigger to do something like:

(where tab1.p_id = tab2.p_id)
if tab1.seq is null

        populate tab1.seq with a value from a sequnce else

        do nothing (i.e. it already has a value in seq from an earlier insert into tab2)

        end if         

regards

Chris



remove the animal to reply Received on Fri Aug 03 2001 - 07:16:06 CDT

Original text of this message

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