473,320 Members | 1,794 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

To create 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
0 985

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Darren | last post by:
Hello, I have some 'CREATE TRIGGER' definitions that work when cut/pasted into SQL*Plus worksheet and execute separately but fail with a 'trigger created with compilation errors' when executed...
1
by: Lisa Tang | last post by:
Hi, I have a table t1 with a long raw column, and I need to create a view v1 with a long raw column being a function ff1 of the long raw column in t1. And I need to update t1 with reverse...
1
by: Jack | last post by:
I created a trigger in the "source table" that will "feed" and second table. The trigger is as follows: CREATE TRIGGER ON dbo.FromUPS FOR INSERT AS Declare @Count int Select @Count =...
4
by: SAEED BASUDAN | last post by:
Hi i have 2 Table first one : Customer with 4 Fields : cst_no,cst_name,total_Debit,tot_credit second one : Transaction with 5 Fields : Trns_no,Trns_Date,cst_no,debit,credit MY QUESTION:...
2
by: Tborn2b | last post by:
DB2 V 7, Z/OS: I receive an SQLCODE -104 for the following trigger : CREATE TRIGGER TRSERED1 NO CASCADE BEFORE INSERT ON SEMINAR REFERENCING NEW AS ZUGANG
2
by: rdraider | last post by:
I created and successfully tested a trigger on a test database. Now that I want to put this on a production system, the create trigger statement takes way too long to complete. I cancelled after...
8
by: FM | last post by:
Hello: I want to create a trigger wich performs a write-action to a text file. I'm intending to create it with: CREATE TRIGGER TR_ALARMA_TSPRE AFTER INSERT ON T_ALARMA_TS FOR EACH STATEMENT...
2
by: graju80 | last post by:
Hey Gurus..I am trying to figures out where my syntax is incorrect in the following SQL to to create an after insert trigger... I am getting SQL0206N "INSERTROW.MF_USERID" is not valid in the...
3
by: Andrea MF | last post by:
Hi all, i have a problem when creating a trigger on DB2 ver 7.2 on WINDOWS. I have two tables MOVIMAG and BARCODE, the trigge when INSERT INTO MOVIMAG will be UPDATE a MOVIMAG field BARCODE...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.