General Question
I understand what the PL/SQL code below is supposed to do, but when I run the code, it won't compile. Can anybody help with why this is so?
DECLARE
CREATE TABLE Ten_Multiples
( Numbervalue number(3));
BEGIN
FOR i IN 9 .. 101 LOOP
IF (i = 50 OR i = 90) THEN
ELSIF (i%10 = 0) THEN
insert into Ten_Multiples
VALUE (i);
END IF;
END LOOP;
END;
I get that the above code should enter the following values into the table: 10, 20, 30, 40, 60, 70, 80, 100. I just can’t understand why it won’t compile. (The code is not mine…the professor posted it and asked us to tell what the outcome will be. I wanted to test it to check my answer, but it’s giving me issues. The problem lies in the line ELSIF i%10 = 0 THEN.
4 Answers
Answer this question
This question is in the General Section. Responses must be helpful and on-topic.