Subject | Re: doing cascade update manually? |
---|---|
Author | José Lacerda |
Post date | 2003-12-13T17:25:32Z |
Dave,
I think you could achieve thiw with triggers.
set term ^;
create trigger b_upd_t1 for t1
before update
as
begin
if (...) then /* Test if can change */
update t2 set i = new.i where i = old.i;
else
exception ...
end^
set term ;^
HTH,
With regards,
José Lacerda
UTILsoft, Lda
Portugal
--- In firebird-support@yahoogroups.com, David Garamond <lists@z...>
wrote:
I think you could achieve thiw with triggers.
set term ^;
create trigger b_upd_t1 for t1
before update
as
begin
if (...) then /* Test if can change */
update t2 set i = new.i where i = old.i;
else
exception ...
end^
set term ;^
HTH,
With regards,
José Lacerda
UTILsoft, Lda
Portugal
--- In firebird-support@yahoogroups.com, David Garamond <lists@z...>
wrote:
> create table t1 (id int not null primary key, i int, unique(i));(i));
> create table t2 (id int not null primary key, i int references t1
>allow
> insert into t1 values (1,1);
> insert into t1 values (2,2);
> insert into t2 values (1,1);
>
> t2(i) is not declared 'cascade update'. Can I update t1(i) like this
>
> update t1 set i=3 where id=1;
>
> as well as updating t2(i)? In other words, I want to do cascade
> manually/case-by-case in this situation (sometimes I want to forbid
> changes to a referenced unique column, and sometimes I want to
> that change and propagating the changes to all referencing columnsas well).
>
> --
> dave