Total number of days from the beginning of Oracle computing to the current date

Source: Internet
Author: User

Oracle calculates the cumulative cross-day time dimension TABLE from the beginning of the year to the current DATE: www.2cto.com SQL code CREATE TABLE D_TIME (D_DAY DATE NOT NULL, C_DAY_ID VARCHAR2 (8) NOT NULL, C_MONTH_ID VARCHAR2 (8) not null, C_MONTH_END_DATE VARCHAR2 (8) not null, C_YEAR_ID VARCHAR2 (8) not null, C_YEAR_END_DATE VARCHAR2 (8) not null); SQL code www.2cto.com select d1.c _ day_id, d1.d _ day sd_day, d1.d _ day-to_date (d1.c _ year_id | '000000', 'yyyymmdd') + 1 timespan, -- Cross days d1.c _ month_id, d1.c _ month_end_date, d1.c _ year_id, d1.c _ year_end_date, d2.d _ day d_day from d_time d1 inner join d_time d2 on d1.c _ year_id = d2.c _ year_id and d1.d _ day> = d2.d _ day where d1.d _ day> = to_date ('123' | | '01 ', 'yyyymmdd') -- import the start time and d1.d _ day <= last_day (to_date ('20170101', 'yyyymmdd') -- import the end time

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.