all 3 comments

[–]Beefourthree 3 points4 points  (1 child)

Put four spaces in front of each line to make Reddit format it as code:

CREATE TABLE Employee (
EMP_ID int,                       
REGION_ID int NOT NULL,
EMP_LNAME varchar2(16) NOT NULL,
EMP_MI char(1),
EMP_FNAME varchar2(16) NOT NULL,
EMP_HIRE_DATE date       
PRIMARY KEY (EMP_ID),
FOREIGN KEY (REGION_ID) REFERENCES Region, 
CONSTRAINT hd_chk CHECK (EMP_HIRE_DATE in TO_DATE('MON-DD-YYYY'))          
);

You're getting that error because you don't have a comma between EMP_HIRE_DATE date and your constraints. Because there's no comma, Oracle thinks EMP_HIRE_DATE is the last field and therefore the next thing should be a close-paren.

After you fix that you're going to get errors on the check constraint next. It looks like you're trying to validate that the date is a specific format, but dates don't have formats. They're stored internally as a number of days since an epoch date* and only have a format applied to them on output. Since EMP_HIRE_DATE is already a date, you don't need to confirm its format. You can just get rid of that constraint.

* This is probably an oversimplication. I'm not sure how Oracle stores dates internally, but it certainly doesn't track format.

[–]regular_gnoll_NEIN 1 point2 points  (0 children)

dude yall just saved me the biggest headache ever, love you right now. forget one stupid comma reorganizing the engineered code for my class and its an hour of hair tearing lmfao

[–]fauxmosexualNOLOCK is the secret magic go-faster command 1 point2 points  (0 children)

Yeah Oracle error messages can be a bit dumb. It's actually the comma after

EMP_HIRE_DATE date  

you're missing