0

Summary

I'm trying to insert two rows into a simple table having two var_char columns, but it ends up with "ORA-00900 invalid SQL statement" pointing to the part FOR loop_counter IN 1..2.

What I've tried

Followed the description at https://www.techonthenet.com/oracle/loops/for_loop.php Checked internet for similar problems, but it looks like the problem is rather exotic.

The code

FOR loop_counter IN 1..2
LOOP
    INSERT INTO table_a
        (COLUMN_ONE, COLUMN_TWO)
    Values
        ('value_one', 'value_two');
END LOOP;

COMMIT;

Thanks in advance!

1 Answer 1

2

You are missing BEGIN END, learn more about anonymous block here

BEGIN
   FOR loop_counter IN 1 .. 2
   LOOP
      INSERT INTO table_a
         (column_one
         ,column_two)
      VALUES
         ('value_one'
         ,'value_two');
   END LOOP;
   COMMIT;
END;
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.