1

I'm getting an error executing the following SQL statement:

String sql = "CREATE TABLE RESERVATION (";
sql = sql + " UID VARCHAR,";
sql = sql + " ISBN INTEGER,";
sql = sql + " DATEISSUE DATE,";
sql = sql + " DATERETURN DATE,";
sql = sql + " FOREIGN KEY (UID) REFERENCES USERS (UID),";
sql = sql + " FOREIGN KEY (ISBN) REFERENCES BOOKS (ISBN) )";

Here is the error I am getting:

java.sql.SQLSyntaxErrorException: Syntax error: Encountered "," at line 1, column 39.

1
  • VARCHAR(SIZE) maybe? Commented Apr 18, 2013 at 21:07

1 Answer 1

2

Column 39 is near the end of the varchar, so you probably need a size for it, such as varchar(20).

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks i was ignoring that and looking at different thins Thanks.

Your Answer

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.