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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.