Re: developer 2000 key-delrec
Date: Wed, 05 Apr 2000 08:30:25 +0930
Message-ID: <38EA7409.5F27DF88_at_hotmail.com>
Try Pre-Delete trigger
ssharma24_at_my-deja.com wrote:
> I have a form that is based on a table that has two fields in it (id,
> name). One field (id) of that table is based on a database sequence
> (it gets created as you add data to the other field). We are not
> showing the sequence field on the form.
> I have key-delrec on the the block that has code that checks for any
> child records . (The sequence key field (ID) is a foreign key in
> another table, we check for child records based on the sequence key
> field. The “name field is not referenced in any other table).
>
> My question is:
> Although I do have a key-delrec to stop the deletion of a “record”, but
> I am being able to delete the ‘name’ field. I don’t want user to be
> able to delete the ‘name’ field if the id related to it has child
> records.
>
> I wrote some code like this: (what trigger do I put it in or is it the
> write code????)
> declare
> vcount number;
> vid varchar2(10);
> cursor name_check is
> select id from A
> where name = :block.name;
>
> begin
> open name_check;
> fetch name_check into vid;
> close name_check;
>
> SELECT COUNT (*)
> INTO vCount
> FROM B
> WHERE id IS NOT NULL
> and id = vid;
>
> IF vCount <> 0 THEN
> bell;
> message(‘message’);
> message(' ',no_acknowledge);
>
> end if;
>
> End;
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
Received on Wed Apr 05 2000 - 01:00:25 CEST