Oracle PL/SQL/System Tables Views/USER SEQUENCES

Материал из SQL эксперт
Перейти к: навигация, поиск

Query user_sequences table

 
SQL>
SQL> SELECT sequence_name, increment_by,
  2         DECODE(cycle_flag,"y","  cycle","n", "nocycle", "nocycle")
  3                cycle_flag,
  4         DECODE(order_flag,"y","  order","n", "noorder", "noorder")
  5                order_flag,
  6         max_value, min_value, cache_size, last_number
  7  FROM   user_sequences
  8  where  rownum < 50
  9  ORDER BY sequence_name;
no rows selected



Query USER_SEQUENCES table to get the sequence info

SQL>
SQL> CREATE SEQUENCE StudentNumSeq
  2    INCREMENT BY 1
  3    START WITH 1100
  4    MAXVALUE 99999
  5    NOCACHE
  6    NOCYCLE;
Sequence created.
SQL>
SQL> SELECT sequence_name, increment_by, cache_size, last_number
  2   FROM USER_SEQUENCES
  3   WHERE sequence_name ="STUDENTNUMSEQ";
SEQUENCE_NAME                  INCREMENT_BY CACHE_SIZE LAST_NUMBER
------------------------------ ------------ ---------- -----------
STUDENTNUMSEQ                             1          0        1100
SQL>
SQL>
SQL> drop sequence StudentNumSeq;
Sequence dropped.
SQL>
SQL>