Manipulating Files with File Commands

Various commands enable you to manipulate files in SQL*Plus. These commands include creating a file, editing the file using a full-screen editor (as opposed to using the SQL*Plus buffer), and redirecting output to a file. You also need to know how to execute a SQL file after it is created.

The SAVE, GET, and EDIT Commands

The SAVE command saves the contents of the SQL statement in the buffer to a file whose name you specify—for example,

SQL> select *
  2  from products
  3  where unit_cost < 25

SQL> save query1.sql

Created file query1.sql

After a file has been saved, you can use the GET command to list the file. ...

Get Sams Teach Yourself SQL in 21 Days, Fourth Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.