0

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)
);
asked Nov 15, 2014 at 18:43

1 Answer 1

1

It's your regexp_like expression that is invalid. You're using your column as if it was a function name. The syntax is:

regexp_like(thing_to_check, pattern [, options])

You should write:

regexp_like(species_imagefile, '[A-Z0-9._%-]+.JPG', 'i')

'i' is for case-insensitive matching.

answered Nov 16, 2014 at 8:45

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.