Well in HSQL we have the limitation of having maximum of 4 arguments , but in our syntax we can increase the number of arguments.The main thing is what I understood from HSQL and PostgreSQL is that an aggregate function would have 2 states.
1) when we compute the result that is the result keeps on getting updated on various calls to the function
2) when we return the result
HSQL does that using the flag so we need to call an additional time with flag == TRUE so that result is returned .
While in PostgreSQL we split the work into two regular functions . The problem is that the second function in PostgreSQL is optional so that adds to a bit of confusion.
The syntax for ORACLE I did not understand properly, would give it a try again .
For SYBASE I have been going through:
For SQL server
DB2 does not support user-defined aggregate functions