Search code examples
sqloracle-databaseoracle-apexsql-insertoracle-apex-5

How do you insert multiple rows of data using SQL or PLSQL into a table in Oracle?


I've been struggling with this for days now, but are not able to insert multiple rows at the same time. It's just basic stuff, see below. Working in Oracle Application Express 5.1.4.00.08.

insert into historie (mnr, beginjaar, begindatum, einddatum, afd, maandsal, opmerkingen) 
values (7499,1988,'01-06-1988','01-07-1989',30,1000,' ');
insert into historie (mnr, beginjaar, begindatum, einddatum, afd, maandsal, opmerkingen) 
values (7499,1989,'01-07-1989','01-12-1993',30,1300,' ');

It only accepts 1 row at a time, and as soon as I try multiple rows it gives this general error:

ORA-00933: SQL command not properly ended


Solution

  • SQL Workshop, right? Include those commands into a begin-end block (and make them PL/SQL instead):

    begin
      insert into historie ...;
      insert into historie ...;
    end;
    /
    

    and then push the RUN button.