Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: newbie question
Hi Bill
You need a look up to the foreign key table in a When_Validate_Item trigger.
When_Validate_Item Trigger for :client.Receipt_No
DECLARE
t_Receipt_no Receipt.receipt_no%TYPE;
CURSOR Receipt_Cur IS
SELECT receipt_no
From receipt
WHERE receipt_no = :client.receipt_no;
BEGIN
OPEN Receipt_Cur;
FETCH Receipt_Cur
INTO t_Receipt_no;
CLOSE Receipt_Cur;
IF t_Receipt_Cur IS NOT NULL THEN
Message('That receipt number already exists')
RAISE Form_Trigger_Failure;
END IF;
END;
Regards
John
FOR UTILITY PARTNERS EMPLOYMENT
OPPORTUNITIES VISIT www.utilpart.com
e-mail: jomarlen_at_aol.com
Web Site: http://members.aol.com/jomarlen/
The views expressed in this message
are those of the author and not
necessarily those of U.P. Inc.
and/or its employees.
>A simple question perhaps for someone more knowledgeable than I.
>
>During the entry process of records into my Client table, I will allow
>the user to leave the Receipt_No field null. If the user enters a value
>into Receipt_No then I want to ensure that that value is not present in
>the Receipt table. If it is present then I want to disallow the record
>to be entered. The same goes for the VIN field and VIN table (including
>allowing a null in VIN field).
>
>********************
>
>Client table
>
>Client_No (PK)
>Receipt_No
>VIN
>
>********************
>
>Receipt table
>
>Receipt_No (PK)
>other fields
>
>********************
>
>VIN table
>
>VIN (PK)
>other fields
>
>********************
>
>
>Thanks in advance for your help...
>
>Bill
>
>
>
>
>
>
>
Received on Tue Oct 14 1997 - 00:00:00 CDT