On 16 February 2017 at 09:15, Hilco Wijbenga <[email protected]> wrote:
> We are using jOOQ 3.6.4 because that is the most recent version that
> does not require JDK 1.8.
>
> I ran into a strange problem yesterday when a jOOQ query did not work.
> I boiled it down to the following:
>
> dslContext
>                 .select(DSL.val(Integer.valueOf(1)))
>                 .getQuery()
>                 .getSQL()
>
> I would expect this to yield:
>
> SELECT 1 FROM DUAL
>
> but instead I get
>
> SELECT ? FROM DUAL
>
> which is the problem I'm having in the original query: each literal
> value turns into a '?' instead of its actual value in the resulting
> SQL query.

As it turns out, this was *not* the reason the query did not work. It
just took me by surprise and pointed me in the wrong direction.

> What is the correct way to get a literal value in a select clause?

So let me rephrase: why doesn't the printed SQL include the literal
value? Clearly, the Param returned by DSL#val is merely a
means-to-an-end and behind the scenes it gets a value. So would it not
be possible to hide it completely when printing the resulting SQL?

-- 
You received this message because you are subscribed to the Google Groups "jOOQ 
User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to