liuyu000 commented on a change in pull request #1837: [TRAFODION-3306] Add the TRUNC Function in the Trafodion SQL Reference Manual URL: https://github.com/apache/trafodion/pull/1837#discussion_r278786666
########## File path: docs/sql_reference/src/asciidoc/_chapters/sql_functions_and_expressions.adoc ########## @@ -12460,6 +12460,122 @@ CHAR(20). This expression uses the TRIM function to return the value TRIM(first_name) || ' ' || TRIM (last_name) ``` +[[trunc_function]] +== TRUNC Function + +The TRUNC (TRUNCATE) function truncates `_numeric-expression_` on an optional `_decimal-place_` decimal position(s), that is, it rounds down `_numeric-expression_` to the nearest (or equal) integer closer to zero *without rounding*. + +TRUNC is a Trafodion SQL extension. + +`TRUNC (_numeric-expression_[, _decimal-place_])` + +[[syntax_descriptions_of_trunc]] +=== Syntax Descriptions of TRUNC + +* `_numeric-expression_` + ++ +is an SQL numeric expression to be truncated. + ++ +For more information, see <<numeric_value_expressions,Numeric Value Expressions>>. + +* `_decimal-place_` + ++ +is an integer specifying the precision of the truncation. + +NOTE: `_numeric-expression_` and `_decimal-place_` cannot be NULL. + +NOTE: Currently, `_decimal-place_` can be zero or a positive integer, while *negative integer* is *not supported*. Review comment: For most databases, TRUNC(123,-1) gives 120, while Trafodion doesn't support negative _decimal-place_. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services
