create or replace trigger grade_
before insert on student_det
for each row
BEGIN
CASE
WHEN new.grade > 10 then dbms_output.put_line('A');
WHEN new.grade > 20 then dbms_output.put_line('A+');
ELSE dbms_output.put_line('Failed');
END
END
When I run the above code, I get the following error
Error at line 4: PLS-00103: Encountered the symbol "WHEN" when expecting one of the following:
:= . ( % ;
The symbol ";" was substituted for "WHEN" to continue.
Error at line 6: PLS-00103: Encountered the symbol "END" when expecting one of the following:
:= . ( % ;
Error at line 5: PLS-00103: Encountered the symbol "ELSE" when expecting one of the following:
:= . ( % ;
The symbol ";" was substituted for "ELSE" to continue.
2. before insert on student_det
3. for each row
4. BEGIN
5. CASE new.grade
6. WHEN 10 then dbms_output.put_line('A')
Could anybody help me out here? I'm relatively new to triggers. My idea is to simply invoke this trigger whenever I insert a new record into student_det record and depending on the conditions given, display the grade obtained by the student.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…