This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-08-01
Channels
- # announcements (1)
- # beginners (71)
- # calva (12)
- # cider (3)
- # clj-kondo (12)
- # cljsrn (9)
- # clojure (167)
- # clojure-dev (21)
- # clojure-europe (5)
- # clojure-italy (60)
- # clojure-nl (6)
- # clojure-spec (6)
- # clojure-uk (60)
- # clojurescript (86)
- # core-async (25)
- # cursive (21)
- # datascript (9)
- # datomic (4)
- # figwheel (8)
- # fulcro (7)
- # graalvm (4)
- # jackdaw (6)
- # jobs (8)
- # juxt (2)
- # leiningen (1)
- # malli (1)
- # off-topic (20)
- # re-frame (31)
- # reagent (5)
- # remote-jobs (3)
- # shadow-cljs (57)
- # sql (6)
- # vim (9)
Wondering if anyone else is has run into this issue: w/ clojure.java.jdbc
:
This works fine against Oracle:
(jdbc/query conn ["SELECT TO_CHAR(TRUNC(\"date_col\"), 'yyyy-Mon-dd') AS \"value\" FROM \"MY_TABLE\" GROUP BY TO_CHAR(TRUNC(\"date_col\"), 'yyyy-Mon-dd')"])
This gives ORA-00979: not a GROUP BY expression
:
(jdbc/query conn ["SELECT TO_CHAR(TRUNC(\"date_col\"), ?) AS \"value\" FROM \"MY_TABLE\" GROUP BY TO_CHAR(TRUNC(\"date_col\"), ?)" "'yyyy-Mon-dd'", "'yyyy-Mon-dd'"])
that is interesting, I don't think I've ever done that with mysql or postgres either, it wouldn't surprise be if you got an error for that other places as well
it is only valid if the select and group by have the same parameter passed in, and the database cannot know that when the query is submitted to make a prepared statement
@xiongtx You should not have the single quotes inside those strings when they are parameters.
'yyyy-Mon-dd'
is a SQL string, "yyyy-Mon-dd"
is a Clojure string.
@seancorfield You're right 👍