Other Functions
Description
SQL functions also support some conversion types and logical operations such as CASE and WHEN. For details, see Table 1.
Syntax
SELECT CAST(fieldname1 AS VARCHAR) AS fieldname1_str
Other Function Statements
Keyword |
Description |
Example |
---|---|---|
CAST(value AS TYPE) |
Converts the data type. Data types can be converted only to varchar or float. |
SELECT fieldname1, CAST(fieldname1 AS VARCHAR) |
CASE WHEN boolean_expr1 THEN result1 \[ WHEN boolean_expr2 THEN result2 ... \] \[ ELSE resultN \] END |
Simple CASE function. |
SELECT CASE WHEN httpStatus = 200 THEN 1 ELSE 0 END |
NULLIF(value1, value2) |
If value1 is equal to value2, null is returned. Otherwise, value1 is returned. |
SELECT fieldname1, fieldname2, NULLIF(fieldname1, fieldname2) |
NVL(expr,expr-for-null) |
If expr is null or an empty string, this function returns expr-for-null. |
SELECT NVL(str1, 'expr-for-null') |
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot