want to run multiple SQL script file in one go with in SQLPLUS

后端 未结 8 667
陌清茗
陌清茗 2021-02-05 23:14

I have to run multiple SQL script file in one go.

Like every time i have to write command in SQLPLUS

SQL>@d:\\a.txt 
SQL>@d:\\a2.txt
SQL>@d:\\a3.txt
SQL>@d:\\         


        
8条回答
  •  旧巷少年郎
    2021-02-05 23:50

    If you're using gnu linux, you could use process substitution:

    sqlplus USERNAME/PASSWORD@DOMAIN < <(cat a.txt a2.txt a3.txt a4.txt) 
    # ... or a for loop on input files, inside the process substitution
    

    Alternatively, you can create a .pdc file and list your sql scripts:

    -- pdc file
    @a.txt;
    @a2.txt;
    @a3.txt;
    @a4.txt;
    

    and call sql plus:

    sqlplus USERNAME/PASSWORD@DOMAIN < my_scripts.pdc
    

提交回复
热议问题