I am attempting to invoke a PL/SQL function via jOOQ using the routines. The function is as follows:
CREATE OR REPLACE FUNCTION myschema.default_sort(rec myschema.mytable)
RETURNS text
LANGUAGE SQL
IMMUTABLE
AS $$
SELECT
TO_CHAR($1.created_at, 'YYYYMMDDHHMMSSMS') || myschema.encode($1.id)
$$;
I am looking to be able to do the equivalent of the following:
SELECT
mt.*,
myschema.default_sort(mt)
FROM
myschema.mytable mt;
So in jOOQ, the routine is generated:
public static Field<String> defaultSort(MyTableRecord rec) {
//do stuff
}
But when it comes time to invoke, I do not know how to pass the current row in the the routine:
dsl.select(
Tables.MYTABLE.asterisk(),
Routines.defaultSort( /* What goes here? */)
)
.from(Tables.MYTABLE)
I can't find anything on the Tables
or dsl
object that suggests a current record. How can I do this?