programmera.net -> oracle -> normal för utskrift | info@programmera.net |
Formattering av utskrift i SQL*Plus
|
Utskrifter i SQL*Plus kan vara lite svårlästa, men med hjälp av några kommandon kan du bestämma hur du vill att de ska se ut. För att ha något att referera till skriver vi ut innehållet i emp helt oformatterad:
SQL> SELECT * FROM emp;
EMPNO ENAME JOB MGR HIREDATE SAL COMM
---------- ---------- --------- ---------- ---------- ---------- ----------
DEPTNO
----------
7369 SMITH CLERK 7902 1980-12-17 800
20
7499 ALLEN SALESMAN 7698 1981-02-20 1600 300
30
7521 WARD SALESMAN 7698 1981-02-22 1250 500
30
EMPNO ENAME JOB MGR HIREDATE SAL COMM
---------- ---------- --------- ---------- ---------- ---------- ----------
DEPTNO
----------
7566 JONES MANAGER 7839 1981-04-02 2975
20
7654 MARTIN SALESMAN 7698 1981-09-28 1250 1400
30
7698 BLAKE MANAGER 7839 1981-05-01 2850
30
EMPNO ENAME JOB MGR HIREDATE SAL COMM
---------- ---------- --------- ---------- ---------- ---------- ----------
DEPTNO
----------
7782 CLARK MANAGER 7839 1981-06-09 2450
10
7788 SCOTT ANALYST 7566 1987-04-19 3000
20
7839 KING PRESIDENT 1981-11-17 5000
10
EMPNO ENAME JOB MGR HIREDATE SAL COMM
---------- ---------- --------- ---------- ---------- ---------- ----------
DEPTNO
----------
7844 TURNER SALESMAN 7698 1981-09-08 1500 0
30
7876 ADAMS CLERK 7788 1987-05-23 1100
20
7900 JAMES CLERK 7698 1981-12-03 950
30
EMPNO ENAME JOB MGR HIREDATE SAL COMM
---------- ---------- --------- ---------- ---------- ---------- ----------
DEPTNO
----------
7902 FORD ANALYST 7566 1981-12-03 3000
20
7934 MILLER CLERK 7782 1982-01-23 1300
10
14 rader.
COLUMN {col} FORMAT {form} [HEADING {head}] |
SQL> COLUMN mgr FORMAT 9999 SQL> COLUMN comm FORMAT 9999 SQL> COLUMN deptno FORMAT 999 SQL> COLUMN ename FORMAT a6 SQL> SELECT * FROM emp; EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO ---------- ------ --------- ----- ---------- ---------- ----- ------ 7369 SMITH CLERK 7902 1980-12-17 800 20 7499 ALLEN SALESMAN 7698 1981-02-20 1600 300 30 7521 WARD SALESMAN 7698 1981-02-22 1250 500 30 7566 JONES MANAGER 7839 1981-04-02 2975 20 7654 MARTIN SALESMAN 7698 1981-09-28 1250 1400 30 7698 BLAKE MANAGER 7839 1981-05-01 2850 30 7782 CLARK MANAGER 7839 1981-06-09 2450 10 7788 SCOTT ANALYST 7566 1987-04-19 3000 20 7839 KING PRESIDENT 1981-11-17 5000 10 7844 TURNER SALESMAN 7698 1981-09-08 1500 0 30 7876 ADAMS CLERK 7788 1987-05-23 1100 20 EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO ---------- ------ --------- ----- ---------- ---------- ----- ------ 7900 JAMES CLERK 7698 1981-12-03 950 30 7902 FORD ANALYST 7566 1981-12-03 3000 20 7934 MILLER CLERK 7782 1982-01-23 1300 10 14 rader. |
set HEADING {on|off} |
SQL> set HEADING off SQL> SELECT * FROM emp; 7369 SMITH CLERK 7902 1980-12-17 800 20 7499 ALLEN SALESMAN 7698 1981-02-20 1600 300 30 7521 WARD SALESMAN 7698 1981-02-22 1250 500 30 7566 JONES MANAGER 7839 1981-04-02 2975 20 7654 MARTIN SALESMAN 7698 1981-09-28 1250 1400 30 7698 BLAKE MANAGER 7839 1981-05-01 2850 30 7782 CLARK MANAGER 7839 1981-06-09 2450 10 7788 SCOTT ANALYST 7566 1987-04-19 3000 20 7839 KING PRESIDENT 1981-11-17 5000 10 7844 TURNER SALESMAN 7698 1981-09-08 1500 0 30 7876 ADAMS CLERK 7788 1987-05-23 1100 20 7900 JAMES CLERK 7698 1981-12-03 950 30 7902 FORD ANALYST 7566 1981-12-03 3000 20 7934 MILLER CLERK 7782 1982-01-23 1300 10 14 rader. |
set LINESIZE {nr} |
SQL> set LINESIZE 120 SQL> SELECT * FROM emp; EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO ---------- ---------- --------- ---------- ---------- ---------- ---------- ---------- 7369 SMITH CLERK 7902 1980-12-17 800 20 7499 ALLEN SALESMAN 7698 1981-02-20 1600 300 30 7521 WARD SALESMAN 7698 1981-02-22 1250 500 30 7566 JONES MANAGER 7839 1981-04-02 2975 20 7654 MARTIN SALESMAN 7698 1981-09-28 1250 1400 30 7698 BLAKE MANAGER 7839 1981-05-01 2850 30 7782 CLARK MANAGER 7839 1981-06-09 2450 10 7788 SCOTT ANALYST 7566 1987-04-19 3000 20 7839 KING PRESIDENT 1981-11-17 5000 10 7844 TURNER SALESMAN 7698 1981-09-08 1500 0 30 7876 ADAMS CLERK 7788 1987-05-23 1100 20 EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO ---------- ---------- --------- ---------- ---------- ---------- ---------- ---------- 7900 JAMES CLERK 7698 1981-12-03 950 30 7902 FORD ANALYST 7566 1981-12-03 3000 20 7934 MILLER CLERK 7782 1982-01-23 1300 10 14 rader. |
set WRAP {on|off} |
SQL> set WRAP off SQL> SELECT * FROM emp; kapad (som begärt) före kolumn DEPTNO EMPNO ENAME JOB MGR HIREDATE SAL COMM ---------- ---------- --------- ---------- ---------- ---------- ---------- 7369 SMITH CLERK 7902 1980-12-17 800 7499 ALLEN SALESMAN 7698 1981-02-20 1600 300 7521 WARD SALESMAN 7698 1981-02-22 1250 500 7566 JONES MANAGER 7839 1981-04-02 2975 7654 MARTIN SALESMAN 7698 1981-09-28 1250 1400 7698 BLAKE MANAGER 7839 1981-05-01 2850 7782 CLARK MANAGER 7839 1981-06-09 2450 7788 SCOTT ANALYST 7566 1987-04-19 3000 7839 KING PRESIDENT 1981-11-17 5000 7844 TURNER SALESMAN 7698 1981-09-08 1500 0 7876 ADAMS CLERK 7788 1987-05-23 1100 EMPNO ENAME JOB MGR HIREDATE SAL COMM ---------- ---------- --------- ---------- ---------- ---------- ---------- 7900 JAMES CLERK 7698 1981-12-03 950 7902 FORD ANALYST 7566 1981-12-03 3000 7934 MILLER CLERK 7782 1982-01-23 1300 14 rader. |
BREAK ON {col} [SKIP {nr}] |
SQL> BREAK ON deptno SQL> SELECT deptno, ename FROM emp ORDER BY deptno; DEPTNO ENAME ---------- ---------- 10 CLARK KING MILLER 20 SMITH ADAMS FORD SCOTT JONES 30 ALLEN BLAKE MARTIN DEPTNO ENAME ---------- ---------- 30 JAMES TURNER WARD 14 rader. |
SQL> BREAK ON deptno SKIP 1 SQL> SELECT deptno, ename FROM emp ORDER BY deptno; DEPTNO ENAME ---------- ---------- 10 CLARK KING MILLER 20 SMITH ADAMS FORD SCOTT JONES 30 ALLEN DEPTNO ENAME ---------- ---------- 30 BLAKE MARTIN JAMES TURNER WARD 14 rader. |
set NULL {text} |
SQL> set WRAP off SQL> set NULL Null SQL> SELECT * FROM emp; kapad (som begärt) före kolumn DEPTNO EMPNO ENAME JOB MGR HIREDATE SAL COMM ---------- ---------- --------- ---------- ---------- ---------- ---------- 7369 SMITH CLERK 7902 1980-12-17 800 Null 7499 ALLEN SALESMAN 7698 1981-02-20 1600 300 7521 WARD SALESMAN 7698 1981-02-22 1250 500 7566 JONES MANAGER 7839 1981-04-02 2975 Null 7654 MARTIN SALESMAN 7698 1981-09-28 1250 1400 7698 BLAKE MANAGER 7839 1981-05-01 2850 Null 7782 CLARK MANAGER 7839 1981-06-09 2450 Null 7788 SCOTT ANALYST 7566 1987-04-19 3000 Null 7839 KING PRESIDENT Null 1981-11-17 5000 Null 7844 TURNER SALESMAN 7698 1981-09-08 1500 0 7876 ADAMS CLERK 7788 1987-05-23 1100 Null EMPNO ENAME JOB MGR HIREDATE SAL COMM ---------- ---------- --------- ---------- ---------- ---------- ---------- 7900 JAMES CLERK 7698 1981-12-03 950 Null 7902 FORD ANALYST 7566 1981-12-03 3000 Null 7934 MILLER CLERK 7782 1982-01-23 1300 Null 14 rader. |
set COLSEP {text} |
SQL> set WRAP off SQL> set COLSEP ";" SQL> SELECT * FROM emp; kapad (som begärt) före kolumn DEPTNO EMPNO;ENAME ;JOB ; MGR;HIREDATE ; SAL; COMM ----------;----------;---------;----------;----------;----------;---------- 7369;SMITH ;CLERK ; 7902;1980-12-17; 800; 7499;ALLEN ;SALESMAN ; 7698;1981-02-20; 1600; 300 7521;WARD ;SALESMAN ; 7698;1981-02-22; 1250; 500 7566;JONES ;MANAGER ; 7839;1981-04-02; 2975; 7654;MARTIN ;SALESMAN ; 7698;1981-09-28; 1250; 1400 7698;BLAKE ;MANAGER ; 7839;1981-05-01; 2850; 7782;CLARK ;MANAGER ; 7839;1981-06-09; 2450; 7788;SCOTT ;ANALYST ; 7566;1987-04-19; 3000; 7839;KING ;PRESIDENT; ;1981-11-17; 5000; 7844;TURNER ;SALESMAN ; 7698;1981-09-08; 1500; 0 7876;ADAMS ;CLERK ; 7788;1987-05-23; 1100; EMPNO;ENAME ;JOB ; MGR;HIREDATE ; SAL; COMM ----------;----------;---------;----------;----------;----------;---------- 7900;JAMES ;CLERK ; 7698;1981-12-03; 950; 7902;FORD ;ANALYST ; 7566;1981-12-03; 3000; 7934;MILLER ;CLERK ; 7782;1982-01-23; 1300; 14 rader. |