Re: Using a Sequence from a Form
Date: Wed, 26 Aug 1998 15:45:21 +0400
Message-ID: <35E3F551.4DAE52AF_at_dd.ru>
You can use PRE-INSERT trigger.
For example (generated by Des2k):
BEGIN
IF (:<your_block>.ID IS NULL) THEN
DECLARE
CURSOR C IS
SELECT <your_sequence>.NEXTVAL
FROM SYS.DUAL;
BEGIN
OPEN C;
FETCH C
INTO :<your_block>.ID;
IF C%NOTFOUND THEN
message('<your_error_message>');
RAISE FORM_TRIGGER_FAILURE;
END IF;
CLOSE C;
EXCEPTION
WHEN OTHERS THEN
<your_code_for_exception>;
END;
END IF;
END; Where ID field is for a unique value.
I hope it will helps you.
Andrew D. Arenson wrote:
>
> I am developing my first Oracle Form. I'm using an installation of D2K,
> with form4.5 and Oracle7.3 on a Solaris platform.
>
> I have created a block. I would like to have new records in that block
> assigned a unique value out of a sequence.
>
> My guess is that the way to achieve this is to place a trigger on the
> block to catch the event 'ON-INSERT'. I'm not sure, however, what pl/sql
> code to place in that trigger. I don't know what pl/sql code I'm replacing
> if I create a trigger for that event.
>
> Does anyone have any suggestions?
>
> Andy
>
> --
> Andrew D. Arenson | http://gc.bcm.tmc.edu:8088/cgi-bin/andy/andy
> Baylor College of Medicine | arenson_at_bcm.tmc.edu (713) H 520-7392
> Genome Sequencing Center, Molecular & Human Genetics Dept. | W 798-4689
> One Baylor Plaza, Room S903, Houston, TX 77030 | F 798-5386
-- Valery A. Sorokin ProSoft, Russia, Moscow, Information Systems Division Phone: +7 (095) 234 0636 (6 lines) FAX: +7 (095) 234 0640 E-mail: vsorokin_at_dd.ru OR vsorokin_at_prosoftmpc.msk.su http://www.dd.ruReceived on Wed Aug 26 1998 - 13:45:21 CEST
