I'm attempting to create a table in Oracle, but keep getting the "ORA-00917":missing comma error at the end of my first constraint (P_IMAGEFILE_CHECK). I've tried adding and taking away commas but nothing has worked, and I do not see how the statement is incorrect. Any suggestions?
CREATE TABLE P_SPECIES (
GENUS VARCHAR2(40 BYTE) NOT NULL,
SPECIES VARCHAR2(40 BYTE) NOT NULL,
COMMONNAME VARCHAR2(80 BYTE) NULL,
SPECIES_DESC VARCHAR2(1000 BYTE) NULL,
SPECIES_IMAGEFILE VARCHAR2(20 BYTE) DEFAULT 'NOIMAGE.JPG' NOT NULL,
CONSTRAINT P_IMAGEFILE_CHECK CHECK
(REGEXP_LIKE(SPECIES_IMAGEFILE(UPPER('[a-zA-Z0-9._%-]+.JPG')))),
CONSTRAINT P_SPECIES_COMMONNAME_UK1 UNIQUE(COMMONNAME),
CONSTRAINT P_SPECIES_PK PRIMARY KEY(GENUS, SPECIES),
CONSTRAINT P_SPECIES_FK1 FOREIGN KEY(GENUS)
REFERENCES P_GENUS(GENUS)
);
Best Answer
It's your
regexp_like
expression that is invalid. You're using your column as if it was a function name. The syntax is:You should write:
'i'
is for case-insensitive matching.