Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-34556

sql_mode=ORACLE: datetime arithmetics: additive expressions

    XMLWordPrintable

Details

    Description

      Let's implement Oracle compatible datetime additive expressions for sql_mode=ORACLE, as follows:

      Operation Result Description
      Datetime + number Datetime Adds a number of days to a datetime
      Datetime - number Datetime Subtracts a number of days from a datetime
      Datetime – datetime Number of days Subracts one datetime from another
      Datetime + number/24 Datetime Adds a number of hours to a date

      Example:

      ALTER SESSION SET NLS_DATE_FORMAT = 'YYYY-MM-DD HH24:MI:SS';
      SELECT SYSDATE, SYSDATE-1, SYSDATE+1 FROM DUAL;
      

      SYSDATE SYSDATE-1 SYSDATE+1
      2024-07-10 07:54:28 2024-07-09 07:54:28 2024-07-11 07:54:28

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              bar Alexander Barkov
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.