ORA-01858:找到一个非数字字符,其中数字是预期的?

时间:2013-11-17 22:38:36

标签: sql oracle ddl sysdate

我需要reg_date列值自动生成为当前系统日期。

本声明:

CREATE TABLE medina_student (
  sno      NUMBER(7)              NOT NULL,
  sname    VARCHAR2(20)           NOT NULL,
  dept     VARCHAR2(5)            NOT NULL,
  reg_date DATE DEFAULT 'sysdate' NOT NULL,
  CONSTRAINT sno_pk PRIMARY KEY (sno),
  CONSTRAINT sna_u UNIQUE (sname)
);

产生错误

reg_date date default 'sysdate' not null ,
                      *
ERROR at line 5:
ORA-01858: a non-numeric character was found where a numeric was expected

如何解决?

1 个答案:

答案 0 :(得分:3)

错误确实在第5行,删除了'

reg_date date default sysdate not null