Hi Mohan,

You chose the SQLDialect.DEFAULT dialect, which is a dialect that can be
used for documentation purposes (e.g. when calling toString(), etc.), and
usually generates SQL standard compliant SQL, if possible, although there
is no such guarantee.

You should replace that dialect by the dialect of your target database, and
then jOOQ will either generate the derived column list as you got it
already"v(c1, c2, c3)", or it will emulate derived column lists using UNION
ALL. This is documented here:
https://blog.jooq.org/2013/01/07/simulating-the-sql-standard/

I hope this helps,
Lukas

2017-11-28 7:25 GMT+01:00 Mohan <[email protected]>:

> Hi,
>
> I need help in the below to code to generate right select from values with
> the values I am passing instead of parameters.
>
> Below is the sample code i am trying to execute.
>
> DSLContext dsl;
> Settings settings = new Settings()
>  .withRenderNameStyle(RenderNameStyle.AS_IS).withRenderFormatted(true);
> dsl = DSL.using(SQLDialect.DEFAULT, settings);
> String sql = 
> dsl.select().from(DSL.values(DSL.row(43,1234,"value1"),DSL.row(43,1235,"value2"))).getSQL();
> System.out.println(sql);
>
>
> Output is generating as below.
>
>
> select
>   v.c1,
>   v.c2,
>   v.c3
> from (values
>   (?, ?, ?),
>   (?, ?, ?)
> ) v(c1, c2, c3)
>
>
> So I need help in fixing the above to generate as below because my
> database doesn't support column aliases
>
> select
>     column1,
>     column2,
>     column3
> from values (43,1234,'value1'),(43,1235,'value2')
>
> Is there any way I can achieve the above format?
>
> Regards,
> Mohan
>
>
> --
> 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.
>

-- 
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