shuijingping 发表于 2018-9-25 13:39:22

ORACLE 日期转换

  C:\Documents and Settings\Administrator>sqlplus "/as SYSDBA"

  SQL*Plus:>  Copyright (c) 1982, 2002, Oracle Corporation.All rights reserved.
  Connected to:

  Oracle9i Enterprise Edition>  With the Partitioning, OLAP and Oracle Data Mining options

  JServer>  SQL> select current_date,extract(day from current_date) day,extract(year from cu
  rrent_date) year from dual;
  CURRENT_D      DAY       YEAR
  --------- ---------- ----------
  11-OCT-12         11       2012
  SQL> select SYSDATE,extract(hourfrom SYSDATE) hour from dual;
  select SYSDATE,extract(hourfrom SYSDATE) hour from dual
  *
  ERROR at line 1:
  ORA-30076: invalid extract field for extract source-----date不可以EXTRACT 时分秒
  SQL> SELECT EXTRACT(minute FROM TIMESTAMP '2010-10-10 10:10:10') FROM DUAL;
  EXTRACT(MINUTEFROMTIMESTAMP'2010-10-1010:10:10')
  ------------------------------------------------
  10

页: [1]
查看完整版本: ORACLE 日期转换