0

I want to insert some 200 rows dummy data in already existing non-prod DB tables with oracle. I am using sql developer for that. Kindly can someone let me know how can I insert 200 rows data at one go without repetitive insert query.

MT0
  • 143,790
  • 11
  • 59
  • 117
007_programmer
  • 35
  • 1
  • 10

1 Answers1

2

You'd do this in the SQL Worksheet. If you don't want to repeat the insert statement use an anonymous pls/sql block. Example:

create table tmp_t (c1 VARCHAR2(100));

Table TMP_T created.

DECLARE
BEGIN
  FOR r IN 1 .. 200 loop
    INSERT INTO tmp_t (c1) VALUES ('some data, row '||r);
  END LOOP;
  -- up to you if you want to commit this.
  --COMMIT; 
END;
/

PL/SQL procedure successfully completed.

SELECT count(*) from tmp_t;

200
Koen Lostrie
  • 14,938
  • 2
  • 13
  • 19
  • Sorry about the confusion. Edited my question. Actually I want to insert 100 rows data in already existing table so can i do it with the help of above query? – 007_programmer Jun 07 '22 at 11:18
  • 1
    It doesn't matter if table already exists. Either loop as I showed or use INSERT ALL as in the linked questions. Just gave you an example: up to you to modify it to your needs. – Koen Lostrie Jun 07 '22 at 11:26