insert trigger/stored procedure
Posted in 1999
Topics: Stored Procedures & SPL, Triggers, Constraints & Referential Integrity
hi - table A company_name --> constraint on this field, for company(company_name) company_id bla bla Company company_name company_id i wanted to write an insert trigger for the table A such that after it is inserted , the company_id could be updated from the company table to table A. i get error 747 on all my attempts, such as a stored procedure which tries to update the company_id. any ideas?
Edward: How's trigger statement looks like and with SPL sample. It has never failed for me. Rgds Edward Rosenthal wrote: > hi - > table A > company_name --> constraint on this field, for company(company_name) > company_id > bla > bla > > Company > company_name > company_id > > i wanted to write an insert trigger for the table A such that after it > is inserted , > the company_id could be updated from the company table to table A. > i get error 747 on all my attempts, such as a stored procedure which > tries > to update the company_id. > any ideas?
Edward Rosenthal <erosenthal@mfi.com> wrote:
> hi -
> table A
> company_name --> constraint on this field, for
company(company_name)
> company_id
> bla
> bla
>
> Company
> company_name
> company_id
>
> i wanted to write an insert trigger for the table A such that
after it
> is inserted ,
> the company_id could be updated from the company table to table A.
> i get error 747 on all my attempts, such as a stored procedure
which
> tries
> to update the company_id.
> any ideas?
>
>
error 747 means that you cannot work on a column with a
triggered action if any action on the column causes the trigger.
Try a simple insert command with dbaccess nor specifying a value
for company_id neither mention the column in your insert statement.
For example:
insert into tableA
(company_name,
bla,
bla)
values
("Informix",
"BLA1","BLA2"
);
Your insert trigger will work with that.
Try the following:
insert into tableA
(company_name,
company_id,
bla,
bla)
values
("Informix",
"",
"BLA1","BLA2"
);
You will get error 747.
Unfortunately the FORMS - program sperform (part of isql)
behaves as if one has specified all columns.
There are similar restrictions with update triggers.
HTH
Reinhard
Reinhard Habichtsberg <Reinhard.Habichtsberg@unilux.de> wrote: > Unfortunately the FORMS - program sperform (part of isql) > behaves as if one has specified all columns. > To complete: If you do _not_ include the affected column in the FORM (sperform program) all works fine (see also thread with header: default value of a column and sperform) Reinhard