• 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
    
    
  • 相关阅读:
    uoj 36 玛里苟斯
    readlink
    Endless Spin
    rm
    rmdir
    [学习笔记]min-max容斥
    cp
    [HAOI2015]按位或
    java实现第四届蓝桥杯公式求值
    java实现第四届蓝桥杯危险系数
  • 原文地址:https://www.cnblogs.com/prettymdx/p/2067290.html
Copyright © 2020-2023  润新知