Run SCRIPT from PL/SQL Block

后端 未结 5 1053
执笔经年
执笔经年 2020-12-03 20:17

How to use \"START SCRIPT\" in pl/sql block ?

I want to use something like this

declare
begin
   proc(para1,para2);
   execute immediate \'start prom         


        
5条回答
  •  有刺的猬
    2020-12-03 20:56

    You can write a pl/sql block in SqlPlus to check for a parameter from a table then execute a script. In the script to be executed (MyScript.sql below), the statement terminators must be ";" instead of "/"

        declare
        vMyParameter number := 0;  
        begin
    
        select count(*) into vMyParameter
        from MyTable
        where MyCheckValue = 'Y';
    
        if vMyParameter = 1 then
        @MyFolder/MyScript.sql;
    
        end if;
        end;
        /
    

提交回复
热议问题