Re: Trigger Problem
Posted in 1998
Ileana Soler wrote:
>
> A table named "tab1" have the following structure:
> create table tab1 (
> a integer primary key constraint num,
> b integer,
> c integer)> The field named "c" will have the result of a+b.
> I want to fill "c" in a trigger on insert on "tab1", but I can't because
> there are the following rule in Informix: "You cannot reference the
> triggering table in any triggered SQL statement with some exceptions".
> I can fill "c" in a trigger on update, but not on insert (error 747).
> My question is: How can I fullfill calculated fields in tables in Informix
> using triggers or stored procedures calling by triggers?
An alternative would be a view:
CREATE VIEW view1 (a, b, c) AS
SELECT a, b, a + b FROM tab1;
Having column c in your base table means that your database is not in
third normal form. Is that what you want?
--
Peter Lancashire
Information Systems Specialist, Bayer plc
Eastern Way, Bury St Edmunds, Suffolk, IP32 7AH, UK
Tel: +44-1635-562258, Fax: +44-1635-562281
---
If all else fails, read the instructions.
All opinions are my own and not those of Bayer plc.
My Internet plumbing does not allow me to mail and post news together.
Sorry.
---
Join Infuse, the UK Informix User Group at http://www.infuse.org.uk/