Package org.hibernate.dialect.function
Class DB2SubstringFunction
- java.lang.Object
-
- org.hibernate.dialect.function.StandardSQLFunction
-
- org.hibernate.dialect.function.DB2SubstringFunction
-
- All Implemented Interfaces:
SQLFunction
public class DB2SubstringFunction extends StandardSQLFunction
When "substring" function is used for DB2, this implementation ofStandardSQLFunction
will render "substr" or "substring", depending on the last argument being used. If the last argument is a string unit ("CODEUNITS16", "CODEUNITS32", or "OCTETS"), then the function will be rendered as "substring"; otherwise, it will be rendered as "substr". ANSI SQL-92 standard defines "substring" without string units, which is more similar to DB2's "substr", so it makes sense to use DB2's "substr" function when string units are not provided. Background: DB2 has both "substr" and "substring", which are different functions that are not interchangeable. Prior to DB2 11.1, DB2's "substring" function requires an argument for string units; without this argument, DB2 throws an exception. DB2's "substr" function throws an exception if string unit is provided as an argument.
-
-
Constructor Summary
Constructors Constructor Description DB2SubstringFunction()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.lang.String
getRenderedName(java.util.List arguments)
-
Methods inherited from class org.hibernate.dialect.function.StandardSQLFunction
getName, getReturnType, getType, hasArguments, hasParenthesesIfNoArguments, render, toString
-
-
-
-
Method Detail
-
getRenderedName
protected java.lang.String getRenderedName(java.util.List arguments)
- Overrides:
getRenderedName
in classStandardSQLFunction
-
-