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 -> Trigger help

Trigger help

From: Jonus <jonus123_at_yahoo.com>
Date: Tue, 08 Feb 2000 03:21:17 GMT
Message-ID: <87o239$mei$1@nnrp1.deja.com>

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 Mon Feb 07 2000 - 21:21:17 CST

Original text of this message

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