Question

EX.NO. 6 SQL TRIGGER AIM To develop the package for employee management system using SQL triggers. DATABASE SCHEMA EMP (EMPID

The procedure is a sample and needs to be modified.
The software used is oracle 11g.
Provide screen shot of the program running.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

create table emp(EMPID int primary key,
NAME varchar(20),
SALARY int,
COMMISION INT,
DEPT_NO int);

set serveroutput on;
create or replace trigger mytrigger4
before insert on emp
FOR EACH ROW
DECLARE
ENDTRIGGER EXCEPTION;
begin
if inserting then
if :NEW.commision > :NEW.salary THEN
RAISE_APPLICATION_ERROR(-20000,'COMMISION CAN NOT BE GREATER THAN SALARY');
   end if;
   END IF;
EXCEPTION
   WHEN ENDTRIGGER THEN
   dbms_output.put_line('CANNOT INSERT');
END;
/


INSERT INTO EMP VALUES(1,'HARRY',100000,10,1);
INSERT INTO EMP VALUES(2,'JOE',100,1000,1);
INSERT INTO EMP VALUES(3,'JOHN',200,5000,1);
INSERT INTO EMP VALUES(4,'PETER',45000,1000,1);


SELECT * FROM EMP;

SQL> SQL> INSERT INTO EMP UALUES(1, HARRY,100000,10,1); 1 row created. SQL> INSERT INTO EMP UALUES(2, JOE,100,1000,1); IN

Add a comment
Know the answer?
Add Answer to:
The procedure is a sample and needs to be modified. The software used is oracle 11g. Provide screen shot of the program running. EX.NO. 6 SQL TRIGGER AIM To develop the package for employee managemen...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT