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

后端 未结 8 655
陌清茗
陌清茗 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-06 00:01

    Use *.PDC extension file like this

    install.pdc file content

    whenever sqlerror exit sql.sqlcode
    
    prompt started!
    
    prompt 1.executing script 1
    @@install/01.script_1.sql
    
    prompt 2.executing script 2
    @@install/02.script_2.sql
    
    prompt 3.executing script 3
    @@install/03.script_3.sql
    
    prompt finished!
    

    where @@install/ points in which directory is the SQL script located

    0 讨论(0)
  • 2021-02-06 00:02

    Some tricks and command can help you to generate master.sql file and you can run from that location.

     c:\direcotory_location\dir *.sql /-t /b >master.sql
    

    Go to the parent directory open master.sql open using notepad++ remove master.sql line and use regular expression to replace

       \n  with \n @
    

    go to cmd From cmd

        C:\root_directory\sqlplus user/password @master.sql
    

    I find this process very convenient if i have 30 to 40 scripts placed in a single directory.

    0 讨论(0)
提交回复
热议问题