DDL scripts do not need COMMIT statements as per the docs.
If I run these statements in SQL Developer, no commit is required:
CREATE TABLE dummy_table(ID NUMBER(38,0) NOT NULL PRIMARY KEY);
CREATE SEQUENCE dummy_seq START WITH 1 INCREMENT BY 1 NOCACHE;
When I run with sqlplus, log says :
SQL*Plus: Release 19.0.0.0.0 - Production on Wed Jul 3 11:28:54 2024
Version 19.3.0.0.0
Copyright (c) 1982, 2019, Oracle. All rights reserved.
Last Successful login time: Wed Jul 03 2024 11:28:53 +02:00
Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.23.0.0.0
Table created.
Sequence created.
SQL> Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.23.0.0.0
But when I check if the table and sequence were created, I can see that they were not created.
After adding COMMIT at the end of the script, still neither of them were created.
Only after adding COMMIT after each statement, both the table and the sequence were created.
My sqlplus command:
sqlplus USER/"PASSWORD"@DATABASE @ /path/to/script.sql