1-4. Executing a Stored Script
Problem
You have stored an SQL script to your file system and want to execute it in SQL*Plus.
Solution
Assume you have a stored script named my_stored_script.sql
and that it is saved within a directory named /Oracle/scripts/
. You can execute that script using any one of the following approaches:
- Traverse into the directory containing the script, then connect to a database via SQL*Plus, and finally issue the following command:
@my_stored_script.sql
- Open the command line or terminal, connect to the database via SQL*Plus, and issue the following command:
@/Oracle/scripts/my_stored_script.sql
- Open command line or terminal, and issue the following command:
sqlplus username/password@database my_stored_script.sql ...
Get Oracle and PL/SQL Recipes: A Problem-Solution Approach 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.