All Implemented Interfaces:
ColumnExpression, DelegateExpression, SelectExpression

public class Substring extends FunctionExpression
SUBSTRING(column, start, length) scalar function.
  • Field Details

    • start

      protected final int start
      Database index, 1-based.
    • length

      protected final @Nullable Integer length
  • Constructor Details

    • Substring

      public Substring(ColumnExpression target, int start, @Nullable Integer length, ColumnIdentifierGenerator columnIdentifierGenerator)
      Construct a SUBSTRING function.
      Parameters:
      target - Target expression to extract characters from.
      start - The starting position. The first character of a database string is always 1.
      length - The number of characters to return. If null, the function extracts everything from the start position to the end of the text.
      columnIdentifierGenerator - Database provider-specific column identifier generator.
  • Method Details

    • template

      protected String template()
      Description copied from class: FunctionExpression
      Gets the template for the SQL representation of the function.

      The template should contain a single "%s" placeholder for the column identifier.

      Specified by:
      template in class FunctionExpression
      Returns:
      SQL representation template