sqloracle-databaseora-00933

Inserting multiple rows query failed


INSERT INTO EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO)
VALUES  (7499,'ALLEN','SALESMAN',7698,'20-Feb-81',1600,300,30)
      , (7521,'WARD','SALESMAN',7698,'22-Feb-81',1250,500,30);

Tried to insert two rows at the same time. but failed saying "SQL command not properly ended". Can someone please correct the query?

Error:

Error at Command Line : 18 Column : 125 Error report - SQL Error: ORA-00933: SQL command not properly ended 00933. 00000 - "SQL command not properly ended" *Cause: *Action:


Solution

  • try like below

    insert into emp  (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO)
    
    select 7499,'ALLEN','SALESMAN',7698,'20-Feb-81',1600,300,30  from dual
    union all
    select 7521,'WARD','SALESMAN',7698,'22-Feb-81',1250,500,30 from dual