Skip to content

Instantly share code, notes, and snippets.

@dileeph
Created July 6, 2012 13:18
Show Gist options
  • Save dileeph/3060105 to your computer and use it in GitHub Desktop.
Save dileeph/3060105 to your computer and use it in GitHub Desktop.
JooQ - groupBy with function issue - ORA000979
public static Field<String> toChar(Field<Timestamp> timestampField,
String format) {
return Factory.function("to_char", String.class, timestampField,
Factory.val(format));
}
@Test
public void testToChar() {
Field<String> tochar = toChar(MZ_LOGIN_STATISTICS.TIME_IN, "MON");
factory.select(Factory.count(), tochar).from(MZ_LOGIN_STATISTICS)
.join(MZ_USER_DETAILS)
.on(MZ_LOGIN_STATISTICS.USER_ID.equal(MZ_USER_DETAILS.USER_ID))
.groupBy(tochar).fetch();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment