executing a .sql file in sql plus terminal

shashwatZing picture shashwatZing · Aug 19, 2016 · Viewed 72k times · Source

I have written couple of sql scripts in a text file and saved them with a .sql extension. I want to execute these scripts in the sql plus terminal without having to manually type the standalone sql scripts, but i'm struggling with it. If someone could list out the steps involved I would be very grateful.

I could copy and paste those scripts in the terminal but that is not what I am looking at, I want to see if there is a way to provide the path to the scripts in the sql plus editor.

Answer

bhattedon picture bhattedon · Aug 19, 2016

If your filename is myQueries.sql, just type

SQL>@/path/to/my/query/myQueries.sql
SQL>/