Running a Series of SQL Files

A SQL script file can include anything that you can type into the SQL buffer at the SQL> prompt, even commands that execute another SQL script. Yes, you can start a SQL script from within another SQL script. Figure BD3.4 shows a script file that was created using the EDIT command. The file contains multiple SQL statements as well as commands to run other SQL scripts.

SQL> edit main.sql

SQL> @main
Figure BD3.4. Running SQL scripts from within a SQL script.

By starting main.sql, you will be executing each SQL command ...

Get Sams Teach Yourself SQL in 21 Days, Fourth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.