What does it do? Functions for conversions between data types in an AB-SQL statement.
Latest notes:
These SQL functions execute special conversions that cannot be handled in a general CAST>> expression. NON_V5_HINTS
For all type conversion functions, the syntax check is performed in the corresponding strict mode>. ABAP_HINT_END
ABAP_VARIANT_1A ... BINTOHEX( sql_exp )>
ABAP_VARIANT_1B ... HEXTOBIN( sql_exp )>
What does it do? The BINTOHEX> and HEXTOBIN> functions convert byte strings to character strings and vice versa. The argument sql_exp > can be an SQL expression>, where literals are only possible to a limited extend:
BINTOHEX> takes a byte string and converts it to a character string that contains the half bytes of the value of sql_exp> converted to the hexadecimal characters 0> to 9> and A > to F> left justified. The valid argument type is RAW>> with a maximum length of 255. The result has the type CHAR>> with twice the length of the value of sql_exp>.
HEXTOBIN> converts a character string to a byte string whose half bytes are determined from the hexadecimal characters of the value of sql_exp>. Any leading blanks are removed before the conversion from the value of sql_exp> and all trailing blanks are then replaced by 0>. The valid argument types are CHAR>> or NUMC>> with a maximum length of 510. The result has the type RAW>> with half the length of the value of sql_exp>. The number of characters in the argument must be even and can contain only the hexadecimal characters 0> to 9> and A> to F> in uppercase or lowercase and leading and trailing blanks. Character-like literals can be specified. If literals, host variables, or host expressions determine the argument directly, and not as part of a larger SQL expression, they cannot contain any leading blanks. If the argument has a null value>, the result of the entire conversion function is the null value.
Latest notes: NON_V5_HINTS The functions HEXTOBIN> and BINTOHEX> enforce the ABAP_STRICT_768 strict mode from ABAP_RELEASE ABAP_768 / . ABAP_HINT_END
ABAP_EXAMPLE_VX5 The ID> column of the DDIC database table IWREFERENC>> contains 32-character character-like UUIDs> in hexadecimal representation. The statement SELECT> reads a UUID once directly and once as the result of the built-in function HEXTOBIN>. The function produces the same result as a conversion using the class CL_SYSTEM_UUID>>. Of course, in ABAP the simple assignment uuid16 = wa-uuid32> would be possible instead of the method call, since the conversion> of c> to x > has the same result. ABEXA 01289 ABAP_EXAMPLE_END
ABAP_VARIANT_2A ... TO_CLOB( sql_exp )>
What does it do? The TO_CLOB> function converts the value of the operand sql_exp> from a character string of fixed length of type CHAR>> or SSTRING>> to a CLOB> of type STRING>>. The argument sql_exp> can be a column>, a literal>, a host variable>, a host constant>, or an SQL expression>. The data type of the argument must be CHAR>> or SSTRING>>. The result is a CLOB> of type STRING>>. If the argument has a null value>, the result of the conversion function is the null value.
Latest notes:
After the conversion, streaming and locators > can be used on the result and length restrictions can be avoided. For example, when using STRING_AGG> in combination with TO_CLOB>, it is possible to read data strings that are much greater than the strings that can be read with STRING_AGG> alone.
When using streaming and locators> in combination with the conversion function TO_CLOB >, it is not allowed to use LOB interfaces > and the addition CREATING>>. NON_V5_HINTS