Skip to content

Common table expression

Tako Lee edited this page Mar 3, 2024 · 5 revisions

image

Delphi

  • gfmtopt.CTE_NewlineBeforeAs, type of boolean, default is true
  • gfmtopt.CTEComma, type of TLinefeedsCommaOption, default is after comma
  • gfmtopt.CTE_StackColumnList, type of boolean, default is false

Java

  • TODO

Uniform

  • AS keyword in the same line with WITH keyword

    Option: fmt082_cte_as_in_newline = false, type: TFmtBoolean.

    WITH mycte(x) AS (SELECT x = Convert( VARCHAR(1000), 'hello' ) 
                      UNION ALL  
                      SELECT Convert( VARCHAR(1000), x + 'a' )  
                      FROM   mycte  
                      WHERE  Len( x ) < 10 
                      UNION ALL  
                      SELECT Convert( VARCHAR(1000), x + 'b' )  
                      FROM   mycte  
                      WHERE  Len( x ) < 10) 
    SELECT x  
    FROM   mycte  
    ORDER  BY Len( x ), 
              x;  
  • AS keyword in new line

    Option: fmt082_cte_as_in_newline = true, type: TFmtBoolean.

    Option: fmt083_cte_as_indent = n, type: int.

    WITH mycte(x) 
         AS (SELECT x = Convert( VARCHAR(1000), 'hello' ) 
             UNION ALL  
             SELECT Convert( VARCHAR(1000), x + 'a' )  
             FROM   mycte  
             WHERE  Len( x ) < 10 
             UNION ALL  
             SELECT Convert( VARCHAR(1000), x + 'b' )  
             FROM   mycte  
             WHERE  Len( x ) < 10) 
    SELECT x  
    FROM   mycte  
    ORDER  BY Len( x ), 
              x;  
Clone this wiki locally