Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

executing a .sql file in sql plus terminal

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.

like image 269
shashwatZing Avatar asked Aug 19 '16 16:08

shashwatZing


People also ask

How do I run a .SQL File in a database?

To run SQL script in MySQL, use the MySQL workbench. First, you need to open MySQL workbench. Now, File -> Open SQL Script to open the SQL script. Note − Press OK button twice to connect with MySQL.


1 Answers

If your filename is myQueries.sql, just type

SQL>@/path/to/my/query/myQueries.sql SQL>/ 
like image 149
bhattedon Avatar answered Sep 22 '22 19:09

bhattedon