Hi, how to make this code shorter? I have no idea since I'm just learning this Trigger.
PHP Code:
Create Trigger Enrolment
AFTER INSERT OF SubjectName ON SUBJECT
For Each Row
Declare Stud Student%RowTYPE;
Begin
SELECT *
INTO Stud
FROM Student
WHERE stdno= :New.stdno;
IF SubjectName = "DAtabase 1" THEN
SET balance = balance - (:New.crtunits *100)
ELSE
IF SubjectName = "DAtabase 2" THEN
SET balance = balance - (:New.crtunits *100)
ELSE
IF SubjectName = "Ecommerce" THEN
SET balance = balance - (:New.crtunits *100)
ELSE
IF SubjectName = "Accounting 1" THEN
SET balance = balance - (:New.crtunits *100)
ELSE
IF SubjectName = "Book Keeping" THEN
SET balance = balance - (:New.crtunits *100)
ELSE
IF SubjectName = "Physic 1" THEN
SET balance = balance - (:New.crtunits *100)
ELSE
IF SubjectName = "Engineering Math" THEN
SET balance = balance - (:New.crtunits *100)
ELSE
IF SubjectName = "Java Programing" THEN
SET balance = balance - (:New.crtunits *100)
ELSE
IF SubjectName = "C++ Programing" THEN
SET balance = balance - (:New.crtunits *100)
ELSE
IF SubjectName = "Advanced C++" THEN
SET balance = balance - (:New.crtunits *100)
ELSE
IF SubjectName = "Management Information System" THEN
SET balance = balance - (:New.crtunits *100)
ELSE
IF SubjectName = "Database 3" THEN
SET balance = balance - (:New.crtunits *100)
end if
end if
end if
end if
end if
end if
end if
end if
end if
end if
end if
end if
END;