You can use user-defined aggregate functions in SQL DML statements, just like using built-in aggregate functions. User-defined aggregate functions can appear in the SELECT list, ORDER BY clause, or, as part of the predicate, in the HAVING clause.
Applicability
This topic applies only to OceanBase Database Enterprise Edition. OceanBase Database Community Edition provides only the MySQL mode.
This topic still takes SecMax() as an example to show how you can use a user-defined aggregate function.
The following example uses a user-defined aggregate function in the SELECT statement:
SELECT SecMax(salary), deptno
FROM emp
GROUP BY deptno
HAVING SecMax(salary) > 6000;