I'am trying to use more than one if condition in PL\SQL, and it gives me an error:
ORA-06550: line 16, column 5:
PLS-00103: Encountered the symbol "LOOP" when expecting one of the following:
if
here's my code:
declare
price_var number;
st_numb number;
co_pr number;
cursor student_count is select STUDENT_NUMBER,COURSE_PRICE from COURSES;
begin
open student_count;
loop
fetch student_count into st_numb,co_pr;
if st_numb<10 then
update COURSES set COURSE_PRICE=co_pr*1.05;
elseif st_numb>10 then
update COURSES set COURSE_PRICE=co_pr*1.07;
end if;
exit when student_count%notfound;
end loop;
end
can you tell me where is the error ? thanks.
First, I think in PL/SQL it's "elsif" and not "elseif". Then (I dont know if this is important or not), maybe you need the parenthesis around the conditions, I don't know.
Source: https://www.tutorialspoint.com/plsql/plsql_if_then_elsif.htm