I am trying to run the below anonymous block but getting an error ORA-00900: invalid SQL statement
. I know its not possible to issue DDL as static SQL in a PL/SQL block in Oracle. As i have more than 50 sql scripts which needs to be executed in anonymous block its not possible to issue EXECUTE IMMEDIATE
with each and every sql statements. So thats why i have created separate script as a sql file and trying to call from my current anonymous block.
SET SERVEROUTPUT ON;
DECLARE MESSAGE VARCHAR2(100);
CHECK_VERSION VARCHAR2(100);
BEGIN
--- some code to check the version
select PROP_VAL into CHECK_VERSION from RATOR_MONITORING_CONFIGURATION.RM2_PROPERTIES WHERE PROP_NAME ='DB_VERSION';
If CHECK_VERSION != 'V3.0' then
MESSAGE := 'Wrong Version';
-- IF(VERSION WRONG) THEN
-- MEESAGE := <<provide info for user here>>
else
@UpgradeFromV2.1ToV3.0.sql;
end if;
END;