467,185 Members | 1,171 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,185 developers. It's quick & easy.

creatin a trigger

Hi, everyone, I am new here ...

I have a problem to create a after-trigger (update).

Example tables:

CREATE TABLE R
(
log_num SMALLINT NOT NULL,
int_num SMALLINT NOT NULL,
beg_time TIME NOT NULL,
end_time TIME NOT NULL,

PRIMARY KEY (log_num, int_num),

FOREIGN KEY skrbi(br_int) REFERENCES I (int_num)
);

CREATE TABLE I
(
int_num SMALLINT NOT NULL,
name CHAR(50) NOT NULL,

PRIMARY KEY (br_int),
);

CREATE TABLE S
(
mat_num SMALLINT NOT NULL,
cost NUMERIC(7,2) NOT NULL,
stored NUMERIC(7,2) NOT NULL WITH DEFAULT 0,

PRIMARY KEY (br_mat),
);

CREATE TABLE IS
(
int_num SMALLINT NOT NULL,
mat_num SMALLINT NOT NULL,
norm NUMERIC (7,2) NOT NULL,

PRIMARY KEY (int_num, mat_num),

FOREIGN KEY fks(mat_num) REFERENCES S (mat_num),
FOREIGN KEY fki(int_num) REFERENCES I (int_num)
);

I 1-many IS
S 1-many IS
R many-1 I
When I insert new row into the table R, the adequate rows in table S should
be updated. Few or one corresponding fields of column stored (table S)
should be less for the size of the few or one corresponending norm
(table IS).

I am trying to write an update trigger that will send one or few (depends of
the values of table IS) fields from one table (IS) to update one or few
fields in another table (S, multiple rows though).

Sorry if I asked something easy or stupid i am new to this, and my english is
not so good.

Jul 27 '07 #1
  • viewed: 1068
Share:

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Matik | last post: by
6 posts views Thread by Scott CM | last post: by
9 posts views Thread by Martin | last post: by
reply views Thread by JohnO | last post: by
7 posts views Thread by Shane | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.