Hi Buddhika, Thanks for your message. I'm not sure what your exact question is, here. You haven't shared any jOOQ code of what you've tried, or what you're attempting to do with jOOQ specifically. So, I'm assuming, you're just looking for this documentation page? https://www.jooq.org/doc/latest/manual/sql-building/bind-values/named-parameters/
There are Query.bind(String, Object) and similar methods that you could use if you must absolutely avoid binding the value twice, but do note that this doesn't optimise anything as JDBC doesn't support named bind values Lukas On Sun, Jun 5, 2022 at 7:40 AM Buddhika Ekanayake < [email protected]> wrote: > Hi All, > > For a specific case, I want to use jooq as a sql executor to fetch plain > text queries(selectable). Lukas has explained a workaround in this > stackoverflow > <https://stackoverflow.com/questions/57588198/how-to-generate-sql-from-template-and-param-placeholder-with-jooq> > but > I'm not sure it's actually binding the param by name (AS IS) rather than > placing param values according to the binding order @index. (changing the > param name wont effect, query works). > > See below sample query. > > *Select ** > *From mySP(:Val, :Name, 0, 9999) d * > *Left Join Samples s on (s.id_sample = d.id_sample)* > *Where s.ref=:Extref and s.val = :Val* > > Assume the user has requested above selectable sql and send the parameter > values separately. So I need to execute this via jooq with binding each > params by its name at the prepare. These are the steps. > > 1. assign the query to jooq. > 2. prepare it. get/fetch the params list. (in this case :Val, :Name, > :ExtRef) > 3. bind each param by name (note *:Val *is used in 2 places, so single > binding by name should be enough). > > Could anybody kindly show me how to achieve this with JOOQ. > *(Java Spring SOAP API, JOOQ: 3.11.0 on Firebird 3)* > > Thank You. > > Regards, > Buddhika E. > > -- > 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]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/jooq-user/d98a4a42-8379-45e6-9ddf-5f51e9a8a821n%40googlegroups.com > <https://groups.google.com/d/msgid/jooq-user/d98a4a42-8379-45e6-9ddf-5f51e9a8a821n%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- 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]. To view this discussion on the web visit https://groups.google.com/d/msgid/jooq-user/CAB4ELO5ykTHjVjB8XL%2Bu_KPC6-6YS%3DBOF9cbu0q-SftGYx1k%2BQ%40mail.gmail.com.
