I have two scripts which needs to be executed depending on whether a table exists or not in my database.
So I created a 3rd script as below which checks the condition and calls the respective script. [Because my installer cannot reach db and it can only call one script while installation]
declare
cnt number;
begin
select count(*)
into cnt
from all_tables where table_name = 'VQ_REPORT_LAUNCHER';
if (cnt>0) then
begin
@VQ_Alter_Script.sql;
end;
else
begin
@VQ_Create_Script.sql;
end;
end if;
END;
I get the below error - ERROR at line 10: ORA-06550: line 10, column 1: PLS-00103: Encountered the symbol "CREATE" when expecting one of the following:
Note - When I execute my create/alter scripts directly from sql plus it works. Only when I try to execute them through a 3rd script using IF-ELSE , i get the above error in sql plus.