0

I don't know that why I am unable to get these values inserted into the table.For below table:

create table info 
(serial_no number(10), 
name varchar(10));

insert into info(serial_no,name)
values(1,'g'),(2,'u');     /*For this query an error is coming*/

ERROR:

ORA-00933: SQL command not properly ended

a_horse_with_no_name
  • 497,550
  • 91
  • 775
  • 843
Sparkle
  • 11
  • 1
  • 2
  • Looks like you are trying to use SQL Server syntax. Gordon has given you the way to do it in oracle. I just chimed in to make the point that each database product has its own implementation of the SQL language. When faced with syntax issues with rdbms product "A", , you cannot rely on what you know from rdbms product "B". Check the specific product's SQL Language Reference Manual. – EdStevens Jun 19 '21 at 17:16
  • Syntax is [here](https://docs.oracle.com/en/database/oracle/oracle-database/21/sqlrf/INSERT.html). You will notice `insert ... values` only accepts one 'values' expression. – William Robertson Jun 19 '21 at 19:29

1 Answers1

0

Oracle makes it tricky to insert multiple rows in one statement. I usually just use select:

insert into info (serial_no, name)
    select 1, 'g' from dual union all
    select 2, 'u' from dual;
Gordon Linoff
  • 1,198,228
  • 53
  • 572
  • 709