43

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.

shashwatZing
  • 1,550
  • 1
  • 17
  • 24
  • they're just text. if nothing else, cut&paste them. – Marc B Aug 19 '16 at 16:33
  • I could do that , but what I'm looking at is to execute those files by providing the class path to which the files exist. I'm just trying to see if there is a way to do that. Added that poiint in the question @MarcB – shashwatZing Aug 19 '16 at 16:34
  • 2
    This is covered [in the SQL\*Plus documentation](http://docs.oracle.com/cd/E11882_01/server.112/e16604/ch_five.htm#i1210918). – Alex Poole Aug 19 '16 at 17:43

1 Answers1

76

If your filename is myQueries.sql, just type

SQL>@/path/to/my/query/myQueries.sql
SQL>/
bhattedon
  • 1,045
  • 9
  • 11
  • Thanks a lot @bhattdon . This was exactly what I was looking for. – shashwatZing Aug 19 '16 at 16:48
  • 4
    that simple, second row saved me from a lot of trouble ! thanks ! – R13mus Jan 22 '19 at 08:43
  • 2
    For those who wonder what the second row is about (/(slash)): Executes the most recently executed SQL command or PL/SQL block which is stored in the SQL buffer. The buffer has no command history and does not record SQL*Plus commands. – sergeyan May 13 '21 at 10:00