Routines and Stored procedures in JOOQ

510 views Asked by At

Am I writing this code correctly?

select sbcm_ref.process_legal_entities_buf_record(legal_entities_buf_id value from table legal_entities_buf)

to

DSL.using(connection)
.select(Routines.processLegalEntitiesBufRecord(field(select(LEGAL_ENTITIES_BUF.LEGAL_ENTITIES_BUF_ID)
.from(LEGAL_ENTITIES_BUF)))).fetch();
1

There are 1 answers

9
Lukas Eder On

I've never seen any (<column> value from table <table>) syntax in SQL (as in your function argument list), so I'm assuming this is just some pseudo SQL you wrote, not actual SQL, or a typo?

The actual SQL would look like this, then?

select sbcm_ref.process_legal_entities_buf_record(legal_entities_buf_id)
from legal_entities_buf

In that case, that would translate 1:1 to jOOQ

ctx.select(Routines.processLegalEntitiesBufRecord(
               LEGAL_ENTITIES_BUF.LEGAL_ENTITIES_BUF_ID))
   .from(LEGAL_ENTITIES_BUF)
   .fetch();