amy
amy

Reputation: 51

How do I fix this error: ORA-00933: SQL command not properly ended

Got this error while trying to enter values for 2 different tables on Oracle APEX and need help figuring out where I went wrong. I'm not sure if it's because I made a typo somewhere or it's because I'm just doing it all wrong.

INSERT INTO copy_student_course_details (grade, student_id, course_id)
VALUES ('A', 720, 190);

INSERT INTO copy_student_course_details (grade, student_id, course_id)
        VALUES ('A', 750, 192);

INSERT INTO copy_student_course_details (grade, student_id, course_id)
    VALUES ('B', 760, 190);

INSERT INTO copy_student_course_details (grade, student_id, course_id)
    VALUES ('A', 770, 194);

INSERT INTO copy_student_course_details (grade, student_id, course_id)
    VALUES ('B', 720, 193);

INSERT INTO copy_student_course_details (grade, student_id, course_id)
    VALUES ('C', 730, 191);

INSERT INTO copy_student_course_details (grade, student_id, course_id)
    VALUES ('F', 740, 195);

INSERT INTO copy_student_course_details (grade, student_id, course_id)
    VALUES ('C', 760, 192);

INSERT INTO copy_student_course_details (grade, student_id, course_id)
    VALUES ('D', 770, 192);

INSERT INTO copy_student_course_details (grade, student_id, course_id)
    VALUES ('F', 770, 193);

INSERT INTO copy_faculty_course_details (contact_hours, faculty_id, course_id)
    VALUES (3, 800, 192);

INSERT INTO copy_faculty_course_details (contact_hours, faculty_id, course_id)
    VALUES (4, 800, 193);

INSERT INTO copy_faculty_course_details (contact_hours, faculty_id, course_id)
    VALUES (5, 800, 190);

INSERT INTO copy_faculty_course_details (contact_hours, faculty_id, course_id)
    VALUES (3, 800, 191);

INSERT INTO copy_faculty_course_details (contact_hours, faculty_id, course_id)
    VALUES (4, 810, 194);

INSERT INTO copy_faculty_course_details (contact_hours, faculty_id, course_id)
    VALUES (5, 810, 195);

Upvotes: 0

Views: 840

Answers (2)

user2464460
user2464460

Reputation: 1

Awesome answer. Worked for me!

Remember that in an Apex IDE (SQL Workshop / SQL Commands) auto-commit is default when you install the environment or using OCI (Autonomous) or apex.oracle.com; If you wanna change it, see here: Disable Auto-Commit in Oracle Application Express

Upvotes: 0

Connor McDonald
Connor McDonald

Reputation: 11586

In APEX you have a SQL commands editor, and a script runner.

A script can contain multiple commands, and they are run one after the other. In the SQL commands window, we run a single command, so after your first insert we are expecting to be done, and hence, when we find more content...we think you first command was not properly ended.

So either save this as a script and run it as a script, or you can run the entire insert as a PLSQL anonymous block, ie

begin
  INSERT INTO copy_student_course_details (grade, student_id, course_id)
VALUES ('A', 720, 190);

INSERT INTO copy_student_course_details (grade, student_id, course_id)
        VALUES ('A', 750, 192);
 ...
...
end;

Upvotes: 1

Related Questions