How Do I Run a Sql Script from Unix Command Line?

How Do I Run a Sql Script from Unix Command Line?
Contents

How do I run a SQL file from Unix command line?

Running a Script as You Start SQL*Plus

  1. Follow the SQLPLUS command with your username, a slash, a space, @, and the name of the file: SQLPLUS HR @SALES. SQL*Plus starts, prompts for your password and runs the script.
  2. Include your username as the first line of the file. Follow the SQLPLUS command with @ and the filename.

How do I run a SQL script in Unix?

To run a SQL script using SQL*Plus, place the SQL along with any SQL*Plus commands in a file and save it on your operating system. For example, save the following script in a file called “C:emp. sql”. CONNECT scott/tiger SPOOL C:emp.

Sarah Jenkins
Author

Sarah Jenkins

Sarah Jenkins is a veteran tech journalist with over 12 years of experience covering artificial intelligence, mobile innovations, and digital ethics. Her insights have appeared in leading technology publications worldwide.