Trigger help

From: Jonus <jonus123_at_yahoo.com>
Date: 2000/02/08
Message-ID: <87o247$men$1_at_nnrp1.deja.com>#1/1


[Quoted] I have two tables. The cus_identi_number in customer references cus_idnti_number in docket. Do I have to create a trigger so that the information entered in cus_identi_number of customer is also entered in the cus_idnti_number column of the docket table? Or does oracle enter the information for you.

I was thinking if this trigger would do the trick:

CREATE OR REPLACE TRIGGER cascade_cus_i

    AFTER INSERT ON CUSTOMER
    FOR EACH ROW
DECLARE
 v_customer_id customer.customer_id%TYPE; BEGIN
    SELECT customer_id
    INTO v_customer_id
    FROM customer
    WHERE customer_id = :new.customer_id;

INSERT into docket

(cus_identi_number)

VALUES
(v_customer_id);

END cascade_cus_i;

customer


cus_identi_number (pk) not null
cus_name               not null
cus_address            not null

docket


docket_number (pk)     not null
docket_time            not null
docket_issuer          null

cus_identi_number (fk) not null

thanks for any help

--
Someone pass a cork to plug the hole in my head


Sent via Deja.com http://www.deja.com/
Before you buy.
Received on Tue Feb 08 2000 - 00:00:00 CET

Original text of this message