Search This Blog

Tuesday 2 February 2016

Execute a SQL script files in sqlplus

Question: How do I execute a SQL script file in SQLPlus?
Answer: To execute a script file in SQLPlus, type @ and then the file name.
SQL> @{yourfile}
For example, if your file was called yourscript.sql, you'd type the following command at the SQL prompt:
SQL> @yourscript.sql
The above command assumes that the file is in the current directory, i.e. the current directory is usually the directory that you were located in before you launched SQLPlus.
If you need to execute a script file that is not in the current directory, you would type:
SQL> @{path}{yourfile}
For example:
SQL> @/oracle/scripts/yourscript.sql

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

No comments:

Post a Comment

Search This Blog