cmd_sqlplus 中的break命令

msdnchina發表於2010-12-02
cmd_sqlplus 中的break命令 ,注意break 是sqlplus命令,不是sql語句。


SQL> select deptno,empno,ename,sal from scott.emp order by deptno;

        10       7782 CLARK            2450
        10       7839 KING             5000
        10       7934 MILLER           1300
        20       7566 JONES            2975
        20       7902 FORD             3000
        20       7876 ADAMS            1100
        20       7369 SMITH             800
        20       7788 SCOTT            3000
        30       7521 WARD             1250
        30       7844 TURNER           1500
        30       7499 ALLEN            1600
        30       7900 JAMES1            950
        30       7698 BLAKE            2850
        30       7654 MARTIN           1250

14 rows selected.

SQL> break on deptno skip 1
SQL> select deptno,empno,ename,sal from scott.emp order by deptno;

        10       7782 CLARK            2450
                 7839 KING             5000
                 7934 MILLER           1300

        20       7566 JONES            2975
                 7902 FORD             3000
                 7876 ADAMS            1100
                 7369 SMITH             800
                 7788 SCOTT            3000

        30       7521 WARD             1250
                 7844 TURNER           1500
                 7499 ALLEN            1600
                 7900 JAMES1            950
                 7698 BLAKE            2850
                 7654 MARTIN           1250




SQL> break on deptno skip 2
SQL> select deptno,empno,ename,sal from scott.emp order by deptno;

        10       7782 CLARK            2450
                 7839 KING             5000
                 7934 MILLER           1300


        20       7566 JONES            2975
                 7902 FORD             3000
                 7876 ADAMS            1100
                 7369 SMITH             800
                 7788 SCOTT            3000


        30       7521 WARD             1250
                 7844 TURNER           1500
                 7499 ALLEN            1600
                 7900 JAMES1            950
                 7698 BLAKE            2850
                 7654 MARTIN           1250



14 rows selected.

SQL> break on deptno
SQL> select deptno,empno,ename,sal from scott.emp order by deptno;

        10       7782 CLARK            2450
                 7839 KING             5000
                 7934 MILLER           1300
        20       7566 JONES            2975
                 7902 FORD             3000
                 7876 ADAMS            1100
                 7369 SMITH             800
                 7788 SCOTT            3000
        30       7521 WARD             1250
                 7844 TURNER           1500
                 7499 ALLEN            1600
                 7900 JAMES1            950
                 7698 BLAKE            2850
                 7654 MARTIN           1250

14 rows selected.

SQL> clear break
breaks cleared
SQL> select deptno,empno,ename,sal from scott.emp order by deptno;

        10       7782 CLARK            2450
        10       7839 KING             5000
        10       7934 MILLER           1300
        20       7566 JONES            2975
        20       7902 FORD             3000
        20       7876 ADAMS            1100
        20       7369 SMITH             800
        20       7788 SCOTT            3000
        30       7521 WARD             1250
        30       7844 TURNER           1500
        30       7499 ALLEN            1600
        30       7900 JAMES1            950
        30       7698 BLAKE            2850
        30       7654 MARTIN           1250

14 rows selected.

SQL>


注意:sqlplus中的一些命令,貌似在PLSQL Developer的 command windows 視窗中,不起作用。下面,我在PLSQL Developer 的command windows 中 做了一下這個實驗。


SQL> select deptno,empno,ename,sal from scott.emp order by deptno;

DEPTNO EMPNO ENAME            SAL
------ ----- ---------- ---------
    10  7782 CLARK        2450.00
    10  7839 KING         5000.00
    10  7934 MILLER       1300.00
    20  7566 JONES        2975.00
    20  7902 FORD         3000.00
    20  7876 ADAMS        1100.00
    20  7369 SMITH         800.00
    20  7788 SCOTT        3000.00
    30  7521 WARD         1250.00
    30  7844 TURNER       1500.00
    30  7499 ALLEN        1600.00
    30  7900 JAMES1        950.00
    30  7698 BLAKE        2850.00
    30  7654 MARTIN       1250.00

14 rows selected

SQL> break on
SQL> break on deptno
SQL> select deptno,empno,ename,sal from scott.emp order by deptno;

DEPTNO EMPNO ENAME            SAL
------ ----- ---------- ---------
    10  7782 CLARK        2450.00
    10  7839 KING         5000.00
    10  7934 MILLER       1300.00
    20  7566 JONES        2975.00
    20  7902 FORD         3000.00
    20  7876 ADAMS        1100.00
    20  7369 SMITH         800.00
    20  7788 SCOTT        3000.00
    30  7521 WARD         1250.00
    30  7844 TURNER       1500.00
    30  7499 ALLEN        1600.00
    30  7900 JAMES1        950.00
    30  7698 BLAKE        2850.00
    30  7654 MARTIN       1250.00

14 rows selected

SQL> break on deptno skip 222
SQL> select deptno,empno,ename,sal from scott.emp order by deptno;

DEPTNO EMPNO ENAME            SAL
------ ----- ---------- ---------
    10  7782 CLARK        2450.00
    10  7839 KING         5000.00
    10  7934 MILLER       1300.00
    20  7566 JONES        2975.00
    20  7902 FORD         3000.00
    20  7876 ADAMS        1100.00
    20  7369 SMITH         800.00
    20  7788 SCOTT        3000.00
    30  7521 WARD         1250.00
    30  7844 TURNER       1500.00
    30  7499 ALLEN        1600.00
    30  7900 JAMES1        950.00
    30  7698 BLAKE        2850.00
    30  7654 MARTIN       1250.00

14 rows selected

SQL>

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/161195/viewspace-680819/,如需轉載,請註明出處,否則將追究法律責任。

相關文章