Fix bug in TerminalConceptVariablesDataQuery

Bug manifests itself in Oracle. Worked in H2 before.