QUOTE_IDENT scalar function
The QUOTE_IDENT function returns a string that can be used as an identifier in an SQL statement.
The schema is SYSIBM.
Syntax
-
string-expression
-
An expression that specifies the input string. The expression must return a character string, signed numeric value, or datetime value. If the data type of the input string is not VARCHAR, it is implicitly cast to VARCHAR before the function is evaluated. If the data type of the input string is CHAR or VARCHAR, the expression must not be FOR BIT DATA (SQLSTATE 42815).
Result
The data type of the result is VARCHAR, and the result has the same codepage and string units as
the input string. The length attribute of the result depends on the length attribute of the input
string:
Length attribute of the input string | Length attribute of the result |
---|---|
L OCTETS |
min(32672,(L*2)+2) OCTETS |
L CODEUNITS32 |
min(8168,(L*2)+2) CODEUNITS32 |
If the argument can be null, the result can be null. If the argument is null, the result is the null value.
Examples
Statement | Result |
---|---|
quote_ident('HELLO WORLD') |
"HELLO WORLD" |
quote_ident('HELLOWORLD') |
HELLOWORLD |
quote_ident('HELLO_WORLD') |
HELLO_WORLD |
quote_ident('hello world') |
"hello world" |
quote_ident('hello"world') |
"hello""world" |
quote_ident('hello''world') |
"hello'world" |
quote_ident('') |
"" |