How to execute .sql file using another .sql file in Oracle?
oracle, sqlplus
Solution
The root of the problem lays in the `create table frclubs` statement. There are blank lines in
the table definition:
create table frclubs
(
-- here they are
pid number(2) not null,
clubid number(2) not null,
constraint cPIDCLUBIDPK primary key(pid,clubid),
constraint fPIDFK foreign key(pid) references friends(pid),
constraint fCLUBIDFK foreign key(clubid) references clubs(clubid)
);
You have two choices:
Remove blank lines in the `create table frclubs` DDL statement;
Allow SQL*PLUS ignore blank lines in the script issuing `SET SQLBLANKLINES ON` command.
Problem
I try to start cr_tb.sql file using another start.sql file and get an error `unknown command beginning pid number...` The strange thing is that when I simply copy paste the cr_tb.sql content into the SQL*Plus, it executes perfectly. What am I doing wrong? (I have posted the dropbox links)