I try to implement a table function by following Tony Andrews example. But my Sql statement will be several lines long (>20) and will also contain parameters. Is it possible to encapsulate the Sql statement somewhere else and to refer to it from the main function to keep everything more readable?
In traditional programming languages I would assign the raw Sql into a string and replace the parameters as required.