Subject | RE: [firebird-support] How I can know the value of a parent table? |
---|---|
Author | Svein Erling Tysvær |
Post date | 2011-03-26T09:32:18Z |
>Hello everybodyDefine a variable in your trigger, then do something like
>
>I am using Firebird 2.1
>
>I have a parent table (MOVIMCAB) and a child table (MOVIMDET)
>
>In a trigger of MOVIMDET I want to access a value of MOVIMCAB, something
>like that:
>
>IF (MOVIMCAB.MVC_TIPMOV = 'E') THEN
> UPDATE ....
>
>but the message "column unknown" appears. Why? How I can know the value of
>the related column of MOVIMCAB?
>
>MOVIMDET has a foreign constraint:
>ALTER TABLE MOVIMDET ADD CONSTRAINT FK_MOVIMDET1 FOREIGN KEY (MOV_IDENTI)
>REFERENCES MOVIMCAB(MVC_IDENTI);
>
>Thanks in advance.
SELECT MVC_TIPMOV FROM MOVIMCAB MC where MC.MVC_IDENTI = new.MOV_IDENTI into :MyVariable;
IF (MyVariable = 'E') THEN
UPDATE ...
HTH,
Set