TTITLE LEFT ‘DATE’ _DATE CENTER ‘SQL.USER’ SQL.USER RIGHT ‘PAGE’ FORMAT 999 SQL.PNO SKIP 3

BTITLE CENTER ‘Thanks for the report’ RIGHT ‘PAGE’ FORMAT 999 SQL.PNO

SET ECHO OFF ---禁止显示新旧区分的多余语句

SET VERIFY OFF ---禁止显示执行的SQL语句

SET PAGESIZE 30

SET LINESIZE 50

CLEAR COLUMN

COLUMN ENAME HEADING NAME FORMAT A13 WORD_WRAPPED(检索到姓名连续的内容 不会自动换行)

COLUMN SAL FORMAT 999

SELECT ENAME,SAL FROM EMP;

CLEAR COLUMN

TTITLE OFF

BTITLE OFF

 

 

 

_DATE:显示当前日期

SQL.USER:当前用户

SQL.PNO:当前页码

LEFT,CENTER,RIGHT:文本对齐方式

SKIP:空几行开始

FORMAT:定义格式

PAGESIZE,LINESIZE:指定输出页面的大小

HEADING:指定文本列的格式 ENAME HEADING NAME

太容易遗忘了

TTITLE LEFT 'RUN DATE' _DATE CENTER 'RUN USER' SQL.USER RIGHT 'PAGE' FORMAT 999 SQL.PNO SKIP 3
BTITLE CENTER 'THanKs for running the report' RIGHT 'PAGE' FORMAT 999 SQL.PNO
SET ECHO OFF
SET VERIFY OFF
SET PAGESIZE 30
SET LINESIZE 70
CLEAR COLUMN
COLUMN ENAME FORMAT A13 WORD_WRAPPED
COLUMN SAL FORMAT $9999.99

SELECT ENAME,SAL FROM EMP;

CLEAR COLUMNS
TTITLE OFF
BTITLE OFF

执行过的实例

 

SQL> @ table.sql

RUN DATE03-9月 -13           RUN USERSCOTT                    PAGE   1

ENAME               SAL
------------- ---------
SMITH           $800.00
ALLEN          $1600.00
WARD           $1250.00
JONES          $2975.00
MARTIN         $1250.00
BLAKE          $2850.00
CLARK          $2450.00
SCOTT          $3000.00
KING           $5000.00
TURNER         $1500.00
ADAMS          $1100.00
JAMES           $950.00
FORD           $3000.00
MILLER         $1300.00

                     THanKs for running the report            PAGE   1

已选择14行。