Subject | Re: Retrieving field new and old value using variable |
---|---|
Author | Adam |
Post date | 2006-07-18T05:37:51Z |
--- In firebird-support@yahoogroups.com, Helen Borrie <helebor@...>
wrote:
IF OLD.ID <> NEW.ID THEN ...
Where ID is the returned value in the current iteration of the for
select?
Adam
wrote:
>field
> At 01:44 PM 18/07/2006, you wrote:
> >--- In firebird-support@yahoogroups.com, Alexandre Benson Smith
> ><iblist@> wrote:
> > >
> > > TechVale - Gustavo wrote:
> > > > Hi All,
> > > >
> > > > May i retrieve the "new" and "old" field values using its
> >name in a trigger ?into :MyFieldName do
> > > >
> > > > i would like to do something like :
> > > >
> > > > for select <SelectToGetAllFieldsNameInTable>
> > > > beginSQL
> > > > if( <OldFieldNameUsingMyFieldNameVar> <>
> ><NewFieldNameUsingMyFieldNameVar> ) then ...
> > > >
> > > > Thanks in advanced,
> > > >
> > > > Gustavo.
> > > >
> > >
> > > Gustavo,
> > >
> > > You could go the EXECUTE STATEMENT way.
> > >
> > > But I would create a simple app that reads the RDB$Relations,
> > > RDB$Relation_Fields, etc. and generate a script with the full
> > >moment,
> >
> >I think he is talking about the OLD and NEW context variables
> >available within triggers. It looks like he is attempting to cycle
> >through each field in the given table (probably through system
> >tables), then check field by field whether the value has changed,
> >possibly some sort of replication idea.
> >
> >I may be mistaken, but I don't think this is possible at the
> >although I can see its merit.make
>
> Well, it's possible, just as Alexandre suggested, but it doesn't
> a lot of sense. A trigger is created "for" a known table, whichSo how do you do
> presupposes that one knows the structure and therefore the column
> names. It seems to me like a mackerel to catch a sprat.
>
IF OLD.ID <> NEW.ID THEN ...
Where ID is the returned value in the current iteration of the for
select?
Adam