Quantcast
Channel: Question and Answer » oracle
Viewing all articles
Browse latest Browse all 717

How to insert all the dates in a date range into Oracle database?

$
0
0

For instance, The date range is from 26th Jul to 1st Aug, that is

26th Jul, 27th Jul, 28th Jul, 29th Jul, 30th Jul, 31th Jul and 1st Aug

How can I construct a function (of course, I need to implement this function using SQL or PL/SQL) like this:

// insert all the dates from "from" to "to" ("from" and "to" are included)
// into Oracle datebase
bool InsertDateRange(date from, date to) {
    bool state = true;

    for (date d in [from, to]) {
        // insert
    }

    return state;
}

If given a different date range, say [27th Feb, 1st Mar], I also need to know this year is a leap year or a common year.


Viewing all articles
Browse latest Browse all 717

Trending Articles