Joshua
Joshua

Reputation: 547

When trying to create a table using clojure.java.sql/create-table I get the exception

When trying to create a table using clojure.java.sql/create-table I get the exception:

batch entry 0: near "-": syntax error
  [Thrown class java.sql.BatchUpdateException]

The create-table call looks like this:

   (sql/create-table :stories
        [:story-id :integer "PRIMARY KEY"]
        [:story-name :text]
        [:story-name-url :text]
        [:category :text]
        [:genre-one :text]
        [:genre-two :text]
        [:created-on :text]
        [:updated-on :text]
        [:review-count :integer]
        [:chapter-count :integer]
        [:word-count :integer]
        [:rating :integer]
        [:language :integer]
        [:is-complete :boolean]
        [:is-crossover :boolean]
        [:type :text]
        [:pairing :text])))) 

Upvotes: 1

Views: 264

Answers (1)

Joshua
Joshua

Reputation: 547

The problem is that fields can't have the '-' character in them. Changing the '-' to '_' will fix the problem.

Upvotes: 2

Related Questions