I've created a table as fllow:
CREATE TABLE"COMMODITY"
(COM_NO VARCHAR2(10) NOT NULL,
COM_NAME VARCHAR2(100) NOT NULL,
SHOP_NO VARCHAR2(10)NOT NULL,
FRU_NO VARCHAR2(10)NOT NULL,
COM_PRICE NUMBER(10)NOT NULL,
COM_WEIGHT VARCHAR2(30)NOT NULL,
COM_REMARKS CLOB NOT NULL,
COM_PIC1 BLOB,
COM_PIC2 BLOB,
COM_PIC3 BLOB,
COM_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
COM_STATUS VARCHAR2(10) NOT NULL,
COM_STORE NUMBER(10) NOT NULL,
COM_SCORE NUMBER(2,1)NOT NULL,
COM_PEO NUMBER(10)NOT NULL,
CONSTRAINT COM_COM_NO_PK PRIMARY KEY (COM_NO),
CONSTRAINT COM_SHOP_NO_FK FOREIGN KEY (SHOP_NO) REFERENCES SHOP(SHOP_NO),
CONSTRAINT COM_FRU_NO_FK FOREIGN KEY (FRU_NO) REFERENCES FRUIT(FRU_NO)
);
AND the sequence is
CREATE SEQUENCE COM_NO_SEQ
INCREMENT BY 1
START WITH 1
NOMAXVALUE
NOCACHE
NOCYCLE;
I'm trying to do the following:
INSERT INTO COMMODITY VALUES('COM'||LPAD(TO_CHAR(COM_NO_SEQ.NEXTVAL),7,'0'),'平安蘋果','SHO0000001','FRU0000001',1200,'一箱約1斤','好吃的蘋果喔我是CLOB','24-6月-17 03.22.39','上架',80,0,0);
I gave the value to all the column where is NOT NULL.But still have the problem of ORA-00947: not enough values.
Plz tell me why ?
You should provide column names in the insert statement as shown in the following example. If you don't provide a list of columns to map the values, Oracle expects values for all columns of the table.