zoukankan      html  css  js  c++  java
  • OCP-1Z0-051-V9.02-43题

    43. Evaluate the following CREATE SEQUENCE statement:
    CREATE SEQUENCE seq1
    START WITH 100
    INCREMENT BY 10
    MAXVALUE 200
    CYCLE
    NOCACHE;
    The SEQ1 sequence has generated numbers up to the maximum limit of 200. You issue the following
    SQL statement:
    SELECT seq1.nextval FROM dual;
    What is displayed by the SELECT statement?
    A. 1
    B. 10
    C. 100
    D. an error
    Answer: A
     答案解析:
    实验验证:
    1、首先创建这个序列
    sh@TESTDB> CREATE SEQUENCE seq1
      2  START WITH 100
      3  INCREMENT BY 10
      4  MAXVALUE 200
      5  CYCLE
      6  NOCACHE;
     
    Sequence created.
     2、查看值。
    sh@TESTDB> select seq1.nextval from dual;
     
       NEXTVAL
    ----------
           100
     
    sh@TESTDB> select seq1.currval from dual;
     
       CURRVAL
    ----------
           100
     3、因为该序列是循环的,到达最大值后从最小值MINVALUE开始循环,该序列因为省略MINVALUE省略,所以默认为NOMINVALUE最小值为 1,所有又从1开始。
    sh@TESTDB> select seq1.nextval from dual;
     
       NEXTVAL
    ----------
           200
     
    sh@TESTDB>
    sh@TESTDB> select seq1.nextval from dual;
     
       NEXTVAL
    ----------
             1

     

     

     故答案选A

  • 相关阅读:
    Diverse Garland
    Basketball Exercise
    Quasi Binary
    Vacations
    Given Length and Sum of Digits...
    三大集合框架之map
    三大集合框架之Set
    JDBC操作数据库的基本步骤:
    java面试之----堆(heap)、栈(stack)和方法区(method)
    JSP九大隐式对象
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13316938.html
Copyright © 2011-2022 走看看