Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Trigger help
Oracle Is not that Smart, but you are on the rigth track.
Jonus <jonus123_at_yahoo.com> wrote in message
news:87o247$men$1_at_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 Tue Feb 08 2000 - 00:52:41 CST