•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the Oracle section within the Web Development category of DaniWeb, a massive community of 429,996 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,459 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Oracle advertiser: Programming Forums
Views: 1263 | Replies: 4
![]() |
•
•
Join Date: Feb 2008
Posts: 24
Reputation:
Rep Power: 1
Solved Threads: 0
is it possible for a trigger to handles two tables ?
my question,
"Write a PL/SQL trigger that, on the insertion of a donation, will set its bloodGroup to the donor's blood group if the donationType is 'whole' or 'platelets', and null if the donationType is 'plasma'."
and my trigger
now im stucked, i dont have a picture for a trigger to involves two tables, any one can give some hints to me ?
and lastly why my trigger doesn't work for this action ? but it works for insertions that without involving the create the table
my question,
"Write a PL/SQL trigger that, on the insertion of a donation, will set its bloodGroup to the donor's blood group if the donationType is 'whole' or 'platelets', and null if the donationType is 'plasma'."
and my trigger
create or replace trigger Tri
before insert on DONATION
for each row
begin
if :NEW.donationType = 'plasma' then
dbms_output.put_line(:NEW.donationType || ' detected !');
:new.donationType := 'null';
dbms_output.put_line('The donationType will set to ' || :NEW.donationType);
end if;
end;
/
show errors
now im stucked, i dont have a picture for a trigger to involves two tables, any one can give some hints to me ?
and lastly why my trigger doesn't work for this action ? but it works for insertions that without involving the create the table
drop table DONATION cascade constraints;
create table DONATION (
donationID CHAR(7) primary key,
donationDate DATE,
donorID CHAR(4) references DONOR (donorID),
donationType VARCHAR(9),
bloodGroup VARCHAR(3),
donationSize INTEGER
);
insert into DONATION values ('XYZ0001','12-Mar-2008','1235','whole','O-',613);
insert into DONATION values ('ABC0998','12-Mar-2008','1236','plasma',NULL,617);
insert into DONATION values ('DEF4444','26-Mar-2008','1236','platelets','AB-',612);
insert into DONATION values ('XYZ0032','26-Mar-2008','1237','whole','O+',615);
insert into DONATION values ('DEF0900','12-Mar-2008','1238','platelets','O+',614);
insert into DONATION values ('ABC5555','26-Mar-2008','1238','plasma',NULL,613);
insert into DONATION values ('XYZ0090','26-Mar-2008','1234','whole','A+',611);
insert into DONATION values ('XYZ0095','26-Mar-2008','1239','whole','B+',613);
![]() |
•
•
•
•
•
•
•
•
DaniWeb Oracle Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Similar Threads
- Introducing myself and a n00b help question. ;) (C++)
- Student with a "C" question (C)
- Trigger problem (MS SQL)
- What may happen? (Geeks' Lounge)
- A Tricky Question for You! (PHP)
- SQL trigger based on a true/false field value (MS SQL)
- A quick, easy, question (Search Engine Optimization)
- JMF question: question about the unrealized player (Java)
Other Threads in the Oracle Forum
- Previous Thread: Oracle 9i Java RE problem
- Next Thread: Suggest me a E-BOOK for SQL server 2005



Linear Mode