Function Expressions
A function expression can return one or more values from built-in SQL functions or from
user-defined functions, as the following diagram shows.
Function Expressions
1 1
1 %Algebraic Functions2
1 %Bitshift Functions3
1 %CARDINALITY Function4
1 %SQLCODE Function5
1 %DBINFO Function6
1 %Encryption and Decryption Functions7
1 %Exponential and Logarithmic Functions8
1 %HEX Function9
1 %Length Functions10
1 %OLAP Window Functions11
1 %Security Label Support Functions12
1 %Smart-Large-Object Functions13
1 %Time Functions14
1 %Trigonometric Functions15
1 %String-Manipulation Functions16
1 %IFX_ALLOW_NEWLINE Function17
1 %User-Defined Functions18
The following examples show function expressions:
EXTEND (call_dtime, YEAR TO SECOND )
HEX (LENGTH (123 ))
MDY (12 , 7 , 1900 + cur_yr)
TAN (radians)
DATE (365 /2 )
ABS (-32 )
LENGTH ('abc' ) + LENGTH (pvar)
EXP (3 )
HEX (customer_num)
MOD (10 ,3 )
Algebraic Functions Bitshift Functions Bitshift functions perform a bit shift operation on an integer or bigint value and return the shift result.CARDINALITY Function The CARDINALITY function returns the number of elements in a collection column (SET, MULTISET, LIST). SQLCODE Function (SPL) The SQLCODE function takes no arguments, but returns to its calling context the value of sqlca.sqlcode for the most recently executed SQL statement (whether static or dynamic) that the current SPL routine has executed. Only use SQLCODE in the context of a cursor.DBINFO Function Exponential and Logarithmic Functions Exponential and logarithmic functions take at least one argument and return a FLOAT data type. NVL2 Function Returns the second argument when the first argument is not NULL. If the first argument is NULL, the third argument is returned.HEX Function Length functions Use length functions to determine the length of a character column, string, or variable, or of the value returned by a character expression, or (for CHAR_LENGTH in multibyte locales) the number of logical characters.Security Label Support Functions SIGN function The SIGN function returns an indicator of the sign of the argument.Smart-Large-Object Functions The smart-large-object functions support objects of BLOB and CLOB data types:Time Functions The time functions of HCL OneDB accept DATE or DATETIME arguments, or character representation of a DATE or DATETIME value. They typically return DATE or DATETIME values, or convert information that they extract from DATE or DATETIME values into character strings or integers.TO_NUMBER Function The TO_NUMBER function can convert a number or a character expression representing a number value to a DECIMAL data type. Trigonometric Functions The built-in trigonometric functions calculate ratios of the lengths of the sides of right triangles. Two supporting functions, DEGREES and RADIANS , can respectively convert the units of angular values from radians to degrees, and from degrees to radians. String-Manipulation Functions String-manipulation functions perform various operations on strings of characters. Case-Conversion Functions The case-conversion functions perform lettercase conversion on alphabetic characters. In the default locale, only the ASCII characters in the ranges A - Z
and a - z
can be modified by these functions, which enable you to perform case-insensitive searches in your queries and to specify the format of the output.Substring functions The built-in SQL substring functions return substrings from character string arguments, or return positional information for operations on substrings . FORMAT_UNITS Function The FORMAT_UNITS function can interpret strings that specify a number and the abbreviated names of units of memory or of mass storage. IFX_ALLOW_NEWLINE Function The IFX_ALLOW_NEWLINE function sets a newline mode that allows newline characters in quoted strings or disallows newline characters in quoted strings within the current session. User-Defined Functions A user-defined function (UDF) is a routine that you write in SPL or in a language external to the database, such as C or Java, and that returns a value to its calling context.
Have feedback?
Google Analytics is used to store comments and ratings. To provide a comment or rating for a topic, click Accept All Cookies or Allow All in Cookie Preferences in the footer of this page.