Reputation: 319
Using DBVisualizer to execute Oracle queries
BEGIN
FOR counter_var IN 1..50
LOOP
INSERT INTO customers VALUES (counter_var,"Yash","Pune",0,0);
END LOOP;
COMMIT;
END;
/
Getting below error: (Attaching screenshot for a reference) [Code: 6550, SQL State: 65000] ORA-06550: line 4, column 59: PLS-00103: Encountered the symbol "end-of-file" when expecting one of the following: ; [Script position: 99 - 100]
If I used a single quote still get the same error.
Let me know if we can use any other approach to insert multiple records in Oracle 12c
Upvotes: 0
Views: 113
Reputation: 728
Another way to do that:
insert into customer
select level, 'Yash', 'Pune', 0, 0
from dual
connect by level<=50;
And one thing to keep in mind: please write the list of columns to insert into, so that that insert won't fail in the event when someone adds a column to the table you are inserting into. Otherwise, I can't figure why your code failed. Like you had some strange character or so... Normally, in Oracle SQL and PL/SQL, literal strings are enclosed by single quotes, not by double quotes.
Upvotes: 1