The stored functions generated by jOOQ implement org.jooq.Field
, so you can simply add them to the ORDER BY
clause:
selectQuery.addOrderBy(fFoldernumber(...));
Instead of repeating the whole call, you might also want to consider creating a local reference of your stored function call:
Field<?> folder = Routines.fFoldernumber(Folder.FOLDER.FOLDER_RSN).as("FolderNumber");
// ...
selectQuery.addSelect(..., folder);
selectQuery.addOrderBy(folder);