You are viewing a plain text version of this content. The canonical link for it is here.
Posted to codereview@trafodion.apache.org by DaveBirdsall <gi...@git.apache.org> on 2016/12/07 19:24:26 UTC

[GitHub] incubator-trafodion pull request #872: [TRAFODION-2285] Document TO_DATE, TO...

GitHub user DaveBirdsall opened a pull request:

    https://github.com/apache/incubator-trafodion/pull/872

    [TRAFODION-2285] Document TO_DATE, TO_TIME and TO_TIMESTAMP functions

    

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/DaveBirdsall/incubator-trafodion Trafodion2285

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/incubator-trafodion/pull/872.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #872
    
----
commit 88f4a8bf52ed1df24d2aa21b90607516869f6119
Author: Dave Birdsall <db...@apache.org>
Date:   2016-12-07T19:20:06Z

    [TRAFODION-2285] Document TO_DATE, TO_TIME and TO_TIMESTAMP functions

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-trafodion pull request #872: [TRAFODION-2285] Document TO_DATE, TO...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/incubator-trafodion/pull/872


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-trafodion pull request #872: [TRAFODION-2285] Document TO_DATE, TO...

Posted by traflm <gi...@git.apache.org>.
Github user traflm commented on a diff in the pull request:

    https://github.com/apache/incubator-trafodion/pull/872#discussion_r91537769
  
    --- Diff: docs/sql_reference/src/asciidoc/_chapters/sql_functions_and_expressions.adoc ---
    @@ -7523,7 +7526,139 @@ TIMESTAMPDIFF (SQL_TSI_WEEK, DATE '2006-01-01', DATE '2006-01-09')
     ```
     TIMESTAMPDIFF (SQL_TSI_DAY, DATE '2004-03-01', DATE '2004-02-01')
     ```
    -
    +
    +<<<
    +[[to_date_function]]
    +== TO_DATE Function
    +
    +The TO_DATE function converts a character value to a date. The optional
    +second argument describes the format of the character value.
    +
    +```
    +TO_DATE(character-expression [,format-string])
    +```
    +
    +* `_character-expression_`
    ++
    +is an expression that gives a character value.
    +
    +* `_format-string_`
    ++
    +is one of the following character string literals:
    +
    +** 'YYYY-MM-DD'
    +** 'MM/DD/YYYY'
    +** 'DD.MM.YYYY'
    +** 'YYYY-MM'
    +** 'MM/DD/YYYY'
    +** 'YYYY/MM/DD'
    +** 'YYYYMMDD'
    +** 'YY/MM/DD'
    +** 'MM/DD/YY'
    +** 'MM-DD-YYYY'
    +** 'YYYYMM'
    +** 'DD-MM-YYYY'
    +** 'DD-MON-YYYY'
    +** 'DDMONYYYY'
    +
    +If the _format-string_ argument is omitted, 'YYYY-MM-DD' is used as the
    +default.
    +
    +[[examples_of_to_date]]
    +=== Examples of TO_DATE
    +
    +* This function returns the date value '2016-12-07':
    ++
    +```
    +TO_DATE ('2016-12-07')
    +```
    +
    +* This function returns the date value '2016-07-12':
    ++
    +```
    +TO_DATE ('12-07-2016', 'DD-MM-YYYY')
    +```
    +
    +* This function returns the date value '2016-12-07':
    ++
    +```
    +TO_DATE ('07DEC2016', 'DDMONYYYY')
    +```
    +
    +<<<
    +[[to_time_function]]
    +== TO_TIME Function
    +
    +The TO_TIME function converts a character value to a time or timestamp. The
    +second argument describes the format of the character value.
    +
    +```
    +TO_TIME(character-expression ,format-string)
    +```
    +
    +* `_character-expression_`
    ++
    +is an expression that gives a character value.
    +
    +* `_format-string_`
    ++
    +is one of the following character string literals:
    +
    +** 'HH24:MI:SS'
    +** 'YYYYMMDDHH24MISS'
    +** 'DD.MM.YYYY:HH24.MI.SS'
    +** 'YYYY-MM-DD HH24:MI:SS'
    +** 'YYYYMMDD:HH24:MI:SS'
    +** 'MMDDYYYY HH24:MI:SS'
    +** 'MM/DD/YYYY HH24:MI:SS'
    +** 'DD-MON-YYYY HH:MI:SS'
    +** 'MONTH DD, YYYY, HH:MI'
    +** 'DD.MM.YYYY HH24.MI.SS'
    +
    +[[considerations_for_to_time]]
    +=== Considerations for TO_TIME
    +
    +If the _format-string_ is 'HH24:MI:SS', then the output data time is time. Otherwise
    +the output data type is timestamp.
    +
    +[[examples_of_to_time]]
    +=== Examples of TO_TIME
    +
    +* This function returns the time value '17:05:01':
    ++
    +```
    +TO_TIME ('17:05:01', 'HH24:MI:SS')
    +```
    +
    +* This function returns the timestamp value '2016-12-07 17:05:01.000000':
    ++
    +```
    +TO_TIME ('07.12.2016:17.05.01', 'DD.MM.YYYY:HH24.MI.SS')
    +```
    +			
    +<<<
    +[[to_timestamp_function]]
    +== TO_TIMESTAMP Function
    +
    +The TO_TIMESTAMP function converts a character value to a timestamp.
    +	
    +```
    +TO_TIMESTAMP(character-expression)
    +```
    +
    +* `_character-expression_`
    ++
    +is an expression that gives a character value.
    +
    +[[examples_of_to_timestamp]]
    +=== Example of TO_TIMESTAMP
    +
    +* This function returns the timestamp value '2016-12-07 10:01:00':
    ++
    +```
    +TO_TIMESTAMP ('2016-12-07 10:01:00')
    --- End diff --
    
    At first glance, I am guessing TO_TIMESTAMP() is alias to TO_TIME(), but it seems not. So maybe it should explicitly mentioned that the character-expression must in fixed format of YYYY-MM-DD HH24:MI:SS, and no milli-second part.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-trafodion pull request #872: [TRAFODION-2285] Document TO_DATE, TO...

Posted by traflm <gi...@git.apache.org>.
Github user traflm commented on a diff in the pull request:

    https://github.com/apache/incubator-trafodion/pull/872#discussion_r91538161
  
    --- Diff: docs/sql_reference/src/asciidoc/_chapters/sql_functions_and_expressions.adoc ---
    @@ -7523,7 +7526,139 @@ TIMESTAMPDIFF (SQL_TSI_WEEK, DATE '2006-01-01', DATE '2006-01-09')
     ```
     TIMESTAMPDIFF (SQL_TSI_DAY, DATE '2004-03-01', DATE '2004-02-01')
     ```
    -
    +
    +<<<
    +[[to_date_function]]
    +== TO_DATE Function
    +
    +The TO_DATE function converts a character value to a date. The optional
    +second argument describes the format of the character value.
    +
    +```
    +TO_DATE(character-expression [,format-string])
    +```
    +
    +* `_character-expression_`
    ++
    +is an expression that gives a character value.
    +
    +* `_format-string_`
    ++
    +is one of the following character string literals:
    +
    +** 'YYYY-MM-DD'
    +** 'MM/DD/YYYY'
    +** 'DD.MM.YYYY'
    +** 'YYYY-MM'
    +** 'MM/DD/YYYY'
    +** 'YYYY/MM/DD'
    +** 'YYYYMMDD'
    +** 'YY/MM/DD'
    +** 'MM/DD/YY'
    +** 'MM-DD-YYYY'
    +** 'YYYYMM'
    +** 'DD-MM-YYYY'
    +** 'DD-MON-YYYY'
    +** 'DDMONYYYY'
    --- End diff --
    
    It will be helpful to have brief description of each of these 'marks'. what is difference between YY and YYYY, and it must be in upper case? It will be clear what can be valid choices for "MON" as well.
    But this is not a must to have, just a suggestion.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---