0

How to add multiple records at once using SQL in a table in Oracle Live SQL?

I have the used the statement in screenshot(as link) below but got an error-"ORA-00933: SQL command not properly ended"

Screenshot of the statements that I am using

Ishika
  • 3
  • 4

2 Answers2

3

Another option is to use INSERT ALL:

insert all
  into students (sr_no, name, class, sec, contact, total_marks) values (1, 'Ravi' , 10, 'A', 12345, 579)
  into students (sr_no, name, class, sec, contact, total_marks) values (2, 'Ria'  , 10, 'B', 98765, 580)
  into students (sr_no, name, class, sec, contact, total_marks) values (3, 'Aditi', 10, 'A', 98498, 570)
select * From dual;
Littlefoot
  • 131,892
  • 15
  • 35
  • 57
2

You can use values in select .. from dual union all and use INSERT INTO TABLE <t> SELECT ... as follows:

insert into your_table
select val1,2,3,4,5 from dual union all
select val1,2,3,4,5 from dual union all
select val1,2,3,4,5 from dual union all
select val1,2,3,4,5 from dual 

db<>fiddle

Popeye
  • 35,427
  • 4
  • 10
  • 31