Create multiple tables using single .sql script file Create multiple tables using single .sql script file oracle oracle

Create multiple tables using single .sql script file


You need to separate the create table scripts with / or end the command with ;, Try like this,

CREATE TABLE ACCOUNT_DETAILS_TB ( CUSTOMER_ID VARCHAR2(20) NOT NULL , ACCOUNT_ID VARCHAR2(20) NOT NULL )/CREATE TABLE ADDRESS_DETAILS_TB ( ACCOUNT_ID VARCHAR2(20) NOT NULL , ADDRESS_ID VARCHAR2(20) NOT NULL )/

OR

CREATE TABLE ACCOUNT_DETAILS_TB ( CUSTOMER_ID VARCHAR2(20) NOT NULL , ACCOUNT_ID VARCHAR2(20) NOT NULL );CREATE TABLE ADDRESS_DETAILS_TB ( ACCOUNT_ID VARCHAR2(20) NOT NULL , ADDRESS_ID VARCHAR2(20) NOT NULL );


I ran this script by changing the VARCHAR2 to NVARCHAR in SQL Server and found there are 2 tables created in the database in the name of

  • ACCOUNT_DETAILS_TB1
  • ADDRESS_DETAILS_TB2

Here is the screenshot of my database and the 2 tables created are rounded.

Screen shot of my database