How to execute an SQL script file in SQLPlus?

Category: ,

How to execute an SQL script file in SQLPlus?


To execute a script file in SQLPlus, type @ and then the file name.

SQL > @[file]

if your file was called XXX.sql, you'd type the following command at the SQL prompt:

SQL > @script.sql

The above command assumes that the file is in the current directory. (ie: the current directory is usually the directory that you were located in before you launched SQLPlus.)Check the current directory using pw command on linux based systems.

If you need to execute a script file that is not in the current directory, you would type:

SQL > @[path][file]

Example:

SQL > @/oracle/temp/XXX.sql

This command would run a script file called script.sql that was located in the /oracle/temp directory.

Comments (0)

Post a Comment