Re: ** Trigger Problem, please help **
Posted in 1996
It looks like you forgot a small bit of syntax in the trigger
statement. (ref. 2-12 of the "Using Triggers" manual for version 5.X)
If you want a trigger to act on specific columns when an update is
done, then you must list the columns in the create trigger statement.
"If you do not specify a list of triggering columns, the default list
consists of all the columns in the table on which you create the
trigger". (same reference page as above.)
Therefore change your statement to:
create trigger t1 update of a on my_table ...
Hope this helps!
Tracy
}
} Version : RSAM Version 7.10.UC1
}
} I get the following error when I perform the update below. Yet, the manual
} suggests it is OK to perform updates on the same table in pudate triggers
} as
} long as you don't update columns referenced in the original update?
}
} -747 Table or column matches object referenced in triggering
} statement.
}
} This error is returned when a triggered SQL statement acts
} on the triggering table, or when both statements are updates
} and the column being updated in the triggered action is the
} same as the column being updated by the triggering
} statement.
}
} Potential responders, please reply to my email address as well as the
} Newsgroup. Thank You.
}
} The Update
} ----------
}
} update my_table set a=27 where a=1;
}
} The Table
} ---------
}
} { TABLE my_table row size = 4 number of columns = 2 index size = 0 }
} create table my_table
} (
} a smallint,
} b smallint
} default 0
} );
}
} The Trigger
} -----------
}
} create trigger t1 update on my_table before
} (
} update my_table set my_table.b = 999 );
}
}
--
=========================================================================
= Tracy W. Nedd =
= Banctec Inc. - DBA =
= Silver Spring, Md =
= tracyn@banctec.clark.net or tracyn@asd.banctec.com =
=========================================================================
= ALL RIGHTS RESERVED. =
= This posting is copyright and may be used only for the purposes =
= of professional study, or the professional exchange of information. =
= Use of this posting by any commercial organization for the purposes =
= of vilifying another is explicitly prohibited. =
=========================================================================