Send to a Friend

yankeetooter's avatar

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?

Asked by yankeetooter (9651points) September 25th, 2013

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.

Using Fluther

or

Using Email

Separate multiple emails with commas.
We’ll only use these emails for this message.