简体   繁体   中英

ORA-01858: a non-numeric character was found where a numeric was expected?

I need reg_date column value to be generated automatically as current system date.

This statement:

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)
);

produces an error

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

How to fix it?

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

reg_date date default sysdate not null

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM