user4285359
user4285359

Reputation: 151

Literal does not match format string when creating a table

I keep trying to create a basic table. Every time I try to create the table I get the error

literal does not match format string

I'm trying to limit the years of the tournament between 2005 and 2100. The error is between DATE '2005'.

This is my code:

Create table Tournament_T
(Tournament_name VARCHAR (50) PRIMARY KEY NOT NULL,
Tournament_year INTEGER NOT NULL,
CONSTRAINT RANGE CHECK (Tournament_year BETWEEN DATE '2005' AND '2100'),
Tournament_rules CLOB NOT NULL,
Tournament_fee VARCHAR(1000) NOT NULL,
Tournment_eligibility VARCHAR (1000) NOT NULL );
COMMIT;

Upvotes: 3

Views: 68

Answers (1)

Gordon Linoff
Gordon Linoff

Reputation: 1269623

Your constraint is using the date keyword, but you don't need it. Just do:

CONSTRAINT RANGE CHECK (Tournament_year BETWEEN 2005 AND 2100),

Your column is an integer, not a date.

Upvotes: 8

Related Questions