I was thinking of using a Vertica function to take the place of a large chunk of SQL code into which has to be inserted a filter parameter for account_id at various places. Initially it seems I could have used SQL Functions, but according to the following descriptions, probably not.
There seems to a huge disconnect between this explanation of SQL Functions:
https://my.vertica.com/docs/7.1.x/HTML/index.htm#Authoring/SQLReferenceManual/Statements/CREATEFUNCTIONStatements.htm%3FTocPath%3DSQL%2520Reference%2520Manual%7CSQL%2520Statements%7CCREATE%2520FUNCTION%2520Statements%7C_____0
where it states:
"User defined SQL functions are useful for executing complex queries and combining HP Vertica built-in functions"
Looking further into the CREATE SQL FUNCTION page: https://my.vertica.com/docs/7.1.x/HTML/index.htm#Authoring/SQLReferenceManual/Statements/CREATEFUNCTIONSQLFunctions.htm
"Note: Only one RETURN expression is allowed in the CREATE FUNCTION definition. FROM, WHERE, GROUP BY, ORDER BY, LIMIT, aggregation, analytics, and meta function are not allowed."
Not using FROM, WHERE, GROUP BY?? How can the result still be a complex query, or any query at all? Am I missing something there?