我在尝试插入记录时收到错误消息,我已经仔细检查了所有值,并且数据类型是一致的。有人可以帮我发现问题。
CREATE SEQUENCE EMP_ID_SEQ
START WITH 300
INCREMENT BY 1;
CREATE TABLE STAFF(
EMP_ID NUMBER NOT NULL,
EMP_NAME VARCHAR2(20),
EMP_DOB DATE,
EMP_TEL VARCHAR2(20),
EMP_EMAIL VARCHAR2(50),
EMP_ADDR VARCHAR2(100),
EMP_HIREDATE DATE,
EMP_ENDDATE DATE,
EMP_SALARY NUMBER(7,2),
EMP_SUPERVISOR NUMBER,
JOB_CODE NUMBER,
BRA_CODE NUMBER);
CREATE TRIGGER EMP_ID_TRG
BEFORE INSERT ON STAFF
FOR EACH ROW
BEGIN
SELECT EMP_ID_SEQ.NEXTVAL
INTO :NEW.EMP_ID
FROM DUAL;
END;
/
INSERT INTO STAFF VALUES ('Jaime Stark',to_date('29/04/1951','dd/mm/YYYY'),'607 4432-1059','Donec.fringilla.Donec@necurnaet.ca','P.O. Box 891, 5837 Enim Avenue',to_date('16/06/2010','dd/mm/YYYY'),NULL,41695,NULL,1,1);
答案 0 :(得分:8)
INSERT INTO STAFF VALUES (null,'Jaime Stark',to_date('29/04/1951','dd/mm/YYYY'),'607 4432-1059','Donec.fringilla.Donec@necurnaet.ca','P.O. Box 891, 5837 Enim Avenue',to_date('16/06/2010','dd/mm/YYYY'),NULL,41695,NULL,1,1);
或
INSERT INTO STAFF (EMP_NAME,EMP_DOB,EMP_TEL,EMP_EMAIL,EMP_ADDR,EMP_HIREDATE,EMP_ENDDATE,EMP_SALARY,EMP_SUPERVISOR,JOB_CODE,BRA_CODE)
VALUES ('Jaime Stark',to_date('29/04/1951','dd/mm/YYYY'),'607 4432-1059','Donec.fringilla.Donec@necurnaet.ca','P.O. Box 891, 5837 Enim Avenue',to_date('16/06/2010','dd/mm/YYYY'),NULL,41695,NULL,1,1);