Subject | RE: [ib-support] Re: Avoiding a delete |
---|---|
Author | PODESTA Mariano APRE |
Post date | 2002-06-26T16:36:12Z |
use:
if (exists(select ..)) then
throw ..
'exists' is true if 'select' found one or more records.
if (exists(select ..)) then
throw ..
'exists' is true if 'select' found one or more records.
> -----Original Message-----
> From: PUB: rodbracher [mailto:rod@...]
> Sent: MiƩrcoles, 26 de Junio de 2002 12:59
> To: ib-support@yahoogroups.com
> Subject: [ib-support] Re: Avoiding a delete
>
>
> I can't use a Referential Constraint as this is the 'wrong way round'.
> I am not sure how to get the trigger working properly
> It should look something like :
>
> set term ^ ;
> create trigger dealer_bd for dealer before delete as
> begin
> if select count(*) from Table_Sales , Table_Dealer where
> Table_sales.dealer = Table_Dealer.dealer > 0
> then exception my_exception
> end^
> set term ; ^
>
> IBcosole does not like the "Select" - can I do such a thing ?
> Will the dealer parameter be of the dealer the trigger was set off
> with ?
> --- In ib-support@y..., "Martijn Tonies" <m.tonies@u...> wrote:
> > Hi,
> >
> > Try either a BEFORE DELETE trigger that raises an exception
> > if there are records in Table_Sales or a Referential Constraint
> > that does this job for you. Check the Language Reference for
> > this.
> >
> > Martijn Tonies
> > InterBase Workbench - the developer tool for InterBase and Firebird
> > http://www.interbaseworkbench.com
> >
> > Upscene Productions
> > http://www.upscene.com
> >
> > "This is an object-oriented system.
> > If we change anything, the users object."
> >
> >
> > > Hi
> > >
> > > What is the best way to avoid deleting a record ( a dealer ) from
> > > Table_Dealer
> > > if its key_column is Dealer and this is a non-key column in
> > > Table_Sales.
> > >
> > > Ie no delete if the dealer has sales.
> > >
> > > Thanks
> > >
> > > Rod
>
>
> ------------------------ Yahoo! Groups Sponsor
> ---------------------~-->
> Free $5 Love Reading
> Risk Free!
> http://us.click.yahoo.com/3PCXaC/PfREAA/Ey.GAA/67folB/TM
> --------------------------------------------------------------
> -------~->
>
> To unsubscribe from this group, send an email to:
> ib-support-unsubscribe@egroups.com
>
>
>
> Your use of Yahoo! Groups is subject to
> http://docs.yahoo.com/info/terms/
>
>