zoukankan      html  css  js  c++  java
  • The Oracle DUAL Table

    dual表是和Oracle数据字典一起创建的。它实际上只包含dummy这一个column,并且只有一条记录,这条记录的值是X。

    1SQL> desc dual;
    2Name Type Nullable Default Comments
    3----- ----------- -------- ------- --------
    4DUMMY VARCHAR2(1) Y
    5
    6SQL> select * from dual;
    7
    8DUMMY
    9-----
    10X

    dual表的owner是SYS,但所有用户都可以访问它。Although it is possible to delete the one record, or insert additional records, one really should not do that!.

    Next,我们来看一下dual表都有哪些作用。

    --Query current date/time
    SQL> select sysdate from dual;
    SYSDATE
    -----------
    2/06/2011 3

    SQL
    > select to_char(sysdate, 'yyyy-mm-dd hh24:mi:ss') systime from dual;
    SYSTIME
    -------------------
    2011-06-02 03:58:47
     
     --Used as a calculator
    SQL> select 1+2 from dual;
    1+2
    ----------
    3
     --Query the current user
    SQL> select user from dual;
    USER
    ------------------------------
    OPS$GLOBAL
    --Query sequence
    SQL> create sequence seq increment by 2 start with 1;
    Sequence created
    SQL
    > select seq.nextval from dual;
    NEXTVAL
    ----------
    1
    SQL
    > select seq.nextval from dual;
    NEXTVAL
    ----------
    3
    SQL
    > select seq.currval from dual;
    CURRVAL
    ----------
    3
    
    
  • 相关阅读:
    Python shutil模块
    Flask 上传文件
    Flask DBUtils
    flash-session
    Flash 上下文管理
    python 栈
    python 偏函数
    threding.local
    next() 与 nextLine() 区别
    Thread.sleep(1000*3); // 休眠3秒
  • 原文地址:https://www.cnblogs.com/prettymdx/p/2067290.html
Copyright © 2011-2022 走看看