Link to home
Start Free TrialLog in
Avatar of IT_ETL
IT_ETL

asked on

Run master SQL scripts in UNIX environment

I got two create table scripts. I will combine the create table scripts below and create a master script (master_script.sql). The database server is in UNIX. So, the master script needs to run at the UNIX command prompt and at the end of run both of these tables will be created in database under schema name "TEST".

Do I need to write a shell script in oreder to execute this master_script.sql?  Is there another option. Please provide an example.......

CREATE TABLE TEST.TABLE_A
(
  LOGIN_ID                   NUMBER(9),
  PASSWORD              VARCHAR2(8),
  CREATE_DATE         DATE
  );

CREATE TABLE TEST.TABLE_B
(
  MEMBER_ID                                      NUMBER(9),
  MEMBER_STATUS                           VARCHAR2(2 BYTE),
   CHANGE_METHOD_CODE              VARCHAR2(5 BYTE)
);
Avatar of slightwv (䄆 Netminder)
slightwv (䄆 Netminder)

Not sure what the real question is here.

So let's try this:
You need to connect to the database somehow to execute those commands.

Typically you do this with SQL*Plus.  On UNIX you can do a quick 'here' script and don't even need the master SQL file:
sqlplus -s << EOF
conn username/password
CREATE TABLE TEST.TABLE_A
(
  LOGIN_ID                   NUMBER(9),
  PASSWORD              VARCHAR2(8),
  CREATE_DATE         DATE
  );

CREATE TABLE TEST.TABLE_B
(
  MEMBER_ID                                      NUMBER(9),
  MEMBER_STATUS                           VARCHAR2(2 BYTE),
   CHANGE_METHOD_CODE              VARCHAR2(5 BYTE)
);

EOF

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Devinder Singh Virdi
Devinder Singh Virdi
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial