How to execute .sql file using another .sql file in Oracle?

I try to run the cr_tb.sql file using a different start.sql and get an unknown command beginning pid number... error message unknown command beginning pid number... strange thing is that when I just copy the contents of cr_tb.sql to SQL * Also, it works fine.

What am I doing wrong? (I posted dropbox links)

+4
source share
1 answer

The root of the problem lies in the create table frclubs . IN

there are empty lines.

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 options:

  • Delete blank lines in the create table frclubs DDL create table frclubs ;

  • Allow SQL * PLUS to ignore empty lines in the script SET SQLBLANKLINES ON script SET SQLBLANKLINES ON .

+4
source

Source: https://habr.com/ru/post/1497614/


All Articles