When typing in something like:
SELECT LAST_VALUE (val ignore nulls) OVER (PARTITION BY set_id ORDER BY cdate ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) AS last_val1 FROM DUAL
(all on one line in the Toad editor window)
...after clicking the Formatter icon, it does not format nicely. Instead it will format as:
SELECT LAST_VALUE (val ignore nulls) OVER (PARTITION BY set_id ORDER BY cdate ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW)
AS last_val1
FROM DUAL
(on 3 lines, the first is "SELECT" and parameters, and the 2nd line is "AS last_val1", indented far right into the line, and 3rd "FROM DUAL" left aligned)
Below is what I'd call acceptable formatting for such long partitioning clause:
SELECT LAST_VALUE (val ignore nulls) OVER (PARTITION BY set_id
ORDER BY cdate
ROWS BETWEEN UNBOUNDED PRECEDING
AND CURRENT ROW) AS last_val1
FROM DUAL
(5 lines with the "BY" of 'partition by", 'order by", and the "BETWEEN" of 'rows between", and the "AND" of 'and current row' are lined up, indented in to the right. The SELECT and FROM are lined up along the left.)
You need to be signed in and under a current maintenance contract to view premium knowledge articles.
© 2024 Quest Software Inc. ALL RIGHTS RESERVED. Feedback Terms of Use Privacy Cookie Preference Center