Oleksii Hlovatskyi
Oleksii Hlovatskyi

Reputation: 53

Routines and Stored procedures in JOOQ

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();

Upvotes: 1

Views: 764

Answers (1)

Lukas Eder
Lukas Eder

Reputation: 220952

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();

Upvotes: 1

Related Questions