How to use large SQL-query for %{sql:} clause?