Home > Software design >  SQL INSERT INTO multiple rows
SQL INSERT INTO multiple rows

Time:09-27

So, I am getting an error on Oracle Apex which says 'ORA-00933: SQL command not properly ended' . As far as I can see there is no syntax errors within my command, if I am missing something and somebody could help me out that would be great.

My command to create the table:

CREATE TABLE details
(
    ssn INTEGER NOT NULL,
    gender VARCHAR(255),
    hair VARCHAR(255)
);

My command to add rows to the table :

INSERT INTO details(ssn, gender, hair) 
VALUES 
    (112, 'male', 'blonde'), 
    (132, 'female', 'blonde'),
    (882, 'male', 'brown'), 
    (542, 'female', 'black'), 
    (662, 'male', 'red') ;

CodePudding user response:

As far as I can see there is no syntax errors within my command

Actually, there is. Syntax you used is invalid, as far as Oracle is concerned.


'SQL commands' on Oracle Apex, which expects only one command at a time

Actually, no. You can run several of them, just not as SQL but PL/SQL which means that you have to enclose them into BEGIN-END block. Have a look at the screenshot:

Note, however, that not everything can be run that way. DDL would, for example, require dynamic SQL.

CodePudding user response:

Turns out I was using 'SQL commands' on Oracle Apex, which expects only one command at a time to be ran, hence the command not properly ended error.

  • Related