Oracle SQL - SQL Plus Script

Introduction

To undo all column formatting, the command is:

CLEAR COLUMNS 

A script is a text file that is stored in the operating system in the C:/Oracle .../bin directory (Windows) and run with a START command.

In the text file, we can include the COLUMN format, the statement, and then a CLEAR COLUMNS command.

As an example, suppose we have such a script called myscript.txt and it contains the following:

Demo

COLUMN orig_salary FORMAT $990.99 
SELECT empno, ename, 
  orig_salary, --   ww  w.j a  v a2 s. c  o m
  curr_salary 
FROM employee; 
CLEAR COLUMNS

This script presupposes nothing about the formatting of orig_salary, and after it is run, the formatting is not persistent.

The script is executed like this:

START myscript.txt 

or

@myscript.txt 

from the SQL> command line.

Related Topics