Answer the question
In order to leave comments, you need to log in
How to call another script from one script?
Tell me how to call another script from one script.
Here is an example
- two scripts lie side by side. the first create.sql, the second test.sql
the first script checks for the presence of a table in the database and if it is missing, then it executes the second script to create it.
<i>create.sql</i>
declare
table_exist number;
begin
SELECT COUNT(1) INTO table_exist FROM all_tables t WHERE t.table_name = 'TEST';
IF table_exist = 0 THEN
execute immediate '@TEST';
END IF;
end;
/
<i>test.sql</i>
create table TEST
(
piu VARCHAR2(500) not null,
pou VARCHAR2(500)
);
alter table TEST
add constraint PK_TEST primary key (piu)
using index;
SQL> @!Create
declare
*
ERROR at line 1:
ORA-00900: invalid SQL statement
ORA-06512: at line 6
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question