7 Replies Latest reply: Jun 29, 2012 8:11 AM by riedelme RSS

    How to run multiple scripts in sql*plus?

    419698
      I would like to run 2 scripts in sql*plus, how do I do this? I tried the following, but it won't run.

      create table student_new
      AS
      select *
      from student

      /

      insert into student_new
      (last_name, first_name
      values
      (Crop, Jenny)



      The above are the two scripts I want to run, what am I doing wrong.
      Thanks
        • 1. Re: How to run multiple scripts in sql*plus?
          3047
          By scripts do you mean SQL statements?
          Try removing the blank line before the "/",
          and add a slash (or semi-colon) after the
          second statement.
          create table student_new
          AS
          select *
          from student
          /
          
          insert into student_new (last_name, first_name
          values (Crop, Jenny)
          /
          -- CJ
          • 2. Re: How to run multiple scripts in sql*plus?
            400940
            Do you have a solution to run multiple scripts continuosly, one after the other as one script.
            Say I have file1.sql file2.sql, file3.sql.

            I want to create a script run.sql, where this will run file1.sql,file2.sql,file3.sql one after other without any one running one after the other like follows:

            run.sql should have

            begin
            @file1.sql
            @file2.sql
            @file3.sql

            dbms_output.put_line(select sysdate from dual);
            end;

            If I run run.sql all the three scripts should be executed successfully and then display the current time . All these files have update statements(50,000 updates each file).

            Very urgetn. Can some one hlpe, please.

            Thanks in advance.
            • 3. Re: How to run multiple scripts in sql*plus?
              Warren Tolentino
              you can run a series of scripts in sequence. on your run.sql script:
               start file1.sql
               start file2.sql
               start file3.sql
              
               select sysdate from dual;
              hope this helps.
              • 4. Re: How to run multiple scripts in sql*plus?
                839403
                Hi to all,

                Murali Here.

                I have multiple sql scripts(1.sql,2.sql,3.sql,4.sql) i want to complile all the scripts at a time.

                Please can any one suggest me how to compile multiple sql scripts at a time. Can u post one sample script.


                Thanks and waiting for the early replys.
                • 5. Re: How to run multiple scripts in sql*plus?
                  851830
                  how to run all the script files in a particular folder without listing them?
                  is there any short cut to execute all the scripts at once with out adding each file?
                  • 6. Re: How to run multiple scripts in sql*plus?
                    904103
                    This is quite useful. Thanks.
                    Is there a way to run multiple sql scripts , simultaneously though.

                    relating to the above example,
                    run.sql - host sql script

                    file1.sql, file2.sql and file3.sql are to be run simultaneously by somehow invoking them from run.sql.

                    Thanks.
                    • 7. Re: How to run multiple scripts in sql*plus?
                      riedelme
                      user10737256 wrote:
                      This is quite useful. Thanks.
                      Is there a way to run multiple sql scripts , simultaneously though.
                      Not in SQL*PLUS. However, depernding on what Oracle version you are on you can use DBMS_SCHEDULER to run OS commands (including SQL*PLUS invocations). Scripts must be on the server for this to work