Repository: trafodion Updated Branches: refs/heads/master 699583672 -> cb5ebb966
Add SYSTIMESTAMP in *Trafodion SQL Reference Manual* Project: http://git-wip-us.apache.org/repos/asf/trafodion/repo Commit: http://git-wip-us.apache.org/repos/asf/trafodion/commit/33874c52 Tree: http://git-wip-us.apache.org/repos/asf/trafodion/tree/33874c52 Diff: http://git-wip-us.apache.org/repos/asf/trafodion/diff/33874c52 Branch: refs/heads/master Commit: 33874c52b7c3b878517772001a94f8c5d95e7a9e Parents: b19868a Author: liu.yu <[email protected]> Authored: Thu Mar 15 15:37:58 2018 +0800 Committer: liu.yu <[email protected]> Committed: Thu Mar 15 15:37:58 2018 +0800 ---------------------------------------------------------------------- .../sql_functions_and_expressions.adoc | 57 ++++++++++++++++++++ 1 file changed, 57 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/trafodion/blob/33874c52/docs/sql_reference/src/asciidoc/_chapters/sql_functions_and_expressions.adoc ---------------------------------------------------------------------- diff --git a/docs/sql_reference/src/asciidoc/_chapters/sql_functions_and_expressions.adoc b/docs/sql_reference/src/asciidoc/_chapters/sql_functions_and_expressions.adoc index c72feeb..76601c2 100644 --- a/docs/sql_reference/src/asciidoc/_chapters/sql_functions_and_expressions.adoc +++ b/docs/sql_reference/src/asciidoc/_chapters/sql_functions_and_expressions.adoc @@ -7953,6 +7953,63 @@ SELECT SUM (price * qty_available) FROM sales.parts; ``` <<< +[[systimestamp_function]] +== STSTIMESTAMP Function + +The SYSTIMESTAMP function, which is equivalent to the `CURRENT_TIMESTAMP` function, provides much high granularity than the `SYSDATE` function and retrieves the current date and time (including fractional seconds with six-digit precision) of the server rather than the session. + +The returned value is `TIMESTAMP` and the default format is `YYYY-MM-DD HH:MM:SS.FFFFFF`. + +For example, if you execute a query on your local machine located in Shanghai on 2018-03-14 06:00:00 (UTC+8) against a database server located in Berlin on 2018-03-13 23:00:00 (UTC+1), the result of `SELECT SYSTIMESTAMP FROM DUAL;` is 2018-03-13 23:00:00 rather than 2018-03-14 06:00:00. + +``` +SYSTIMESTAMP +``` + +[[examples_of_systimestamp]] +=== Examples of SYSTIMESTAMP + +* This example calculates the date and time of anniversary using SYSTIMESTAMP function. + ++ +``` +SELECT SYSTIMESTAMP AS today, SYSTIMESTAMP + INTERVAL '12' MONTH AS Annisversary FROM DUAL; + +TODAY ANNISVERSARY +-------------------------- -------------------------- +2018-03-15 11:19:42.400382 2019-03-15 11:19:42.400382 + +--- 1 row(s) selected. +``` + +* This example demonstrates how to insert the value of SYSTIMESTAMP into a column. + ++ +``` +SQL>CREATE TABLE test1 (C1 TIMESTAMP, C2 VARCHAR(40)); + +--- SQL operation complete. +``` + ++ +``` +SQL>INSERT INTO test1 VALUES (SYSTIMESTAMP, 'This is the time that I insert values'); + +--- 1 row(s) inserted. +``` + ++ +``` +SQL>SELECT * FROM test1; + +C1 C2 +-------------------------- ---------------------------------------- +2018-03-15 11:33:32.091057 This is the time that I insert values + +--- 1 row(s) selected. +``` + +<<< [[tan_function]] == TAN Function
