日期:2014-05-17  浏览次数:20772 次

Oracle序列的问题?
Oracle序列的问题
(1)
SQL>   connect   scott/tiger
已连接。
SQL>   select   *   from   v$version;

BANNER
-----------------------
Oracle9i   Enterprise   Edition   Release   9.2.0.1.0   -   Production
PL/SQL   Release   9.2.0.1.0   -   Production
CORE         9.2.0.1.0               Production
TNS   for   32-bit   Windows:   Version   9.2.0.1.0   -   Production
NLSRTL   Version   9.2.0.1.0   -   Production

SQL>   select   *   from   tab;   SQL>   select   *   from   user_tables;和SQL>   select   *   from   all_tables;有什么区别和联系?

(2)
SQL>   select   *   from   dept;

        DEPTNO   DNAME                     LOC
----------   --------------   -------------
                10   ACCOUNTING           NEW   YORK
                20   RESEARCH               DALLAS
                30   SALES                     CHICAGO
                40   OPERATIONS           BOSTON

SQL>   create   sequence   sq_dept
                increment   by   10
                start   with   50
                maxvalue   90
                nocache
                nocycle   ;

序列已创建。

SQL>   select   *   from   user_sequences;

SEQUENCE_NAME                                       MIN_VALUE     MAX_VALUE   INCREMENT_BY   C   O   CACHE_SIZE   LAST_NUMBER
------------------------------   ----------   ----------   ------------   -   -   ----------   -----------
SQ_DEPT                                                                   1                   90                       10   N   N                     0                     50

SQL>   select   *   from   dept;

        DEPTNO   DNAME                     LOC
----------   --------------   -------------
                10   ACCOUNTING           NEW   YORK
          &