回覆列表
  • 1 # 使用者990540253822

    oracle中如何插入date型別的資料方法如下:

    insert into tabname(datecol) value(sysdate) ; -- 用date值

    insert into tabname(datecol) value(sysdate+1) ; -- 用date值

    insert into tabname(datecol) value(to_date("2014-02-14","yyyy-mm-dd")) ; -- 用to_date

    insert into tabname(datecol) value(to_date("2014-02-14 20:47:00","yyyy-mm-dd hh24:mi:ss")) ; -- 用to_date

    insert into tabname(datecol) value(to_date("20140214","yyyymmdd")) ; -- 用to_date

    insert into tabname(datecol) value(to_date("20140214204700","yyyymmddhh24miss")) ; -- 用to_date

    select table_name,tablespace_name from user_tables where table_name="EMP";

    drop table EMP;

    create table EMP

    (

    EMPNO NUMBER(6) not null unique,

    ENAME varchar2(20),

    JOB varchar2(20),

    MGR varchar2(20),

    HIREDATE date,

    SAL varchar2(20),

    COMM varchar2(20),

    DEPTNO varchar2(20)

    );

    INSERT INTO EMP VALUES(44449, "小明", "工程師", "ligang",

    to_date("20140214204700","yyyymmddhh24miss"), "1000", "12345", "test");

    commit;

    select xx.empno,xx.ename,xx.job,xx.mgr,xx.hiredate,xx.sal,xx.comm,xx.deptno

    from (select rownum id1,emp.* from emp where rownum<4) xx

    where id1>0;

  • 中秋節和大豐收的關聯?
  • 手機充電頭4個觸點都有用嗎?