Get last 5 day record excluding Weekend days?
I'm trying to extract records from table inserted in last 5 working days on Oracle SQL
I'm unable to exclude Sunday and Saturday from this(as they're coming into consideration)
Select * from xyz where xdate=:businessDate - 5
Here businessDate
(yyyymmdd format) is value taken as a parameter
Any pointers would greatly be valued and appreciated .
sql oracle oracle-sqldeveloper oracle12c plsqldeveloper
|
show 3 more comments
I'm trying to extract records from table inserted in last 5 working days on Oracle SQL
I'm unable to exclude Sunday and Saturday from this(as they're coming into consideration)
Select * from xyz where xdate=:businessDate - 5
Here businessDate
(yyyymmdd format) is value taken as a parameter
Any pointers would greatly be valued and appreciated .
sql oracle oracle-sqldeveloper oracle12c plsqldeveloper
Date=. I don't think that could bei what you are searching
– bummi
Nov 23 '18 at 18:31
Sorry I didn't understood what you're saying
– Shubham Singh
Nov 23 '18 at 18:36
Select * from xyz where xdate=:businessDate - 5 and to_char(:businessDate,'DAY') NOT LIKE 'S%'
– Himanshu Ahuja
Nov 23 '18 at 18:44
@HimanshuAhuja thank you for your quick answer. I want to highlight businessDate is in format of yyyymmdd format. Will that work in your provided solution?
– Shubham Singh
Nov 23 '18 at 18:52
@HimanshuAhuja and when this program gets installed in an oracle db in france, where sunday is "dimanche", and the logic falls apart?
– Caius Jard
Nov 23 '18 at 18:54
|
show 3 more comments
I'm trying to extract records from table inserted in last 5 working days on Oracle SQL
I'm unable to exclude Sunday and Saturday from this(as they're coming into consideration)
Select * from xyz where xdate=:businessDate - 5
Here businessDate
(yyyymmdd format) is value taken as a parameter
Any pointers would greatly be valued and appreciated .
sql oracle oracle-sqldeveloper oracle12c plsqldeveloper
I'm trying to extract records from table inserted in last 5 working days on Oracle SQL
I'm unable to exclude Sunday and Saturday from this(as they're coming into consideration)
Select * from xyz where xdate=:businessDate - 5
Here businessDate
(yyyymmdd format) is value taken as a parameter
Any pointers would greatly be valued and appreciated .
sql oracle oracle-sqldeveloper oracle12c plsqldeveloper
sql oracle oracle-sqldeveloper oracle12c plsqldeveloper
edited Nov 25 '18 at 0:47
Nick
26.1k111836
26.1k111836
asked Nov 23 '18 at 18:23
Shubham SinghShubham Singh
62
62
Date=. I don't think that could bei what you are searching
– bummi
Nov 23 '18 at 18:31
Sorry I didn't understood what you're saying
– Shubham Singh
Nov 23 '18 at 18:36
Select * from xyz where xdate=:businessDate - 5 and to_char(:businessDate,'DAY') NOT LIKE 'S%'
– Himanshu Ahuja
Nov 23 '18 at 18:44
@HimanshuAhuja thank you for your quick answer. I want to highlight businessDate is in format of yyyymmdd format. Will that work in your provided solution?
– Shubham Singh
Nov 23 '18 at 18:52
@HimanshuAhuja and when this program gets installed in an oracle db in france, where sunday is "dimanche", and the logic falls apart?
– Caius Jard
Nov 23 '18 at 18:54
|
show 3 more comments
Date=. I don't think that could bei what you are searching
– bummi
Nov 23 '18 at 18:31
Sorry I didn't understood what you're saying
– Shubham Singh
Nov 23 '18 at 18:36
Select * from xyz where xdate=:businessDate - 5 and to_char(:businessDate,'DAY') NOT LIKE 'S%'
– Himanshu Ahuja
Nov 23 '18 at 18:44
@HimanshuAhuja thank you for your quick answer. I want to highlight businessDate is in format of yyyymmdd format. Will that work in your provided solution?
– Shubham Singh
Nov 23 '18 at 18:52
@HimanshuAhuja and when this program gets installed in an oracle db in france, where sunday is "dimanche", and the logic falls apart?
– Caius Jard
Nov 23 '18 at 18:54
Date=. I don't think that could bei what you are searching
– bummi
Nov 23 '18 at 18:31
Date=. I don't think that could bei what you are searching
– bummi
Nov 23 '18 at 18:31
Sorry I didn't understood what you're saying
– Shubham Singh
Nov 23 '18 at 18:36
Sorry I didn't understood what you're saying
– Shubham Singh
Nov 23 '18 at 18:36
Select * from xyz where xdate=:businessDate - 5 and to_char(:businessDate,'DAY') NOT LIKE 'S%'
– Himanshu Ahuja
Nov 23 '18 at 18:44
Select * from xyz where xdate=:businessDate - 5 and to_char(:businessDate,'DAY') NOT LIKE 'S%'
– Himanshu Ahuja
Nov 23 '18 at 18:44
@HimanshuAhuja thank you for your quick answer. I want to highlight businessDate is in format of yyyymmdd format. Will that work in your provided solution?
– Shubham Singh
Nov 23 '18 at 18:52
@HimanshuAhuja thank you for your quick answer. I want to highlight businessDate is in format of yyyymmdd format. Will that work in your provided solution?
– Shubham Singh
Nov 23 '18 at 18:52
@HimanshuAhuja and when this program gets installed in an oracle db in france, where sunday is "dimanche", and the logic falls apart?
– Caius Jard
Nov 23 '18 at 18:54
@HimanshuAhuja and when this program gets installed in an oracle db in france, where sunday is "dimanche", and the logic falls apart?
– Caius Jard
Nov 23 '18 at 18:54
|
show 3 more comments
5 Answers
5
active
oldest
votes
SELECT *
FROM xyz
WHERE
xdate >= TRUNC(SYSDATE) - 7 --last 7 days AND
TRUNC (xdate) - TRUNC (xdate, 'IW') NOT IN (5,6) --not sat or sun
Take the last 7 days data, and remove any data from saturday or sunday.
TRUNC (xdate) - TRUNC (xdate, 'IW')
returns a value between 0 and 6 inclusive. 0 is monday. This is not affected by NLS date settings because it uses the same region setting in both truncs, so regardless if the week starts on sunday or monday in your country, the result of the calc is the same
In any given 7 day period you have 5 week days and 2 weekend days
Note that this query assumes the table has no future dated data. If it does put a restriction that xdate must be less than sysdate
Thanks @caius jard for your valuable suggestions. I would love to try it out and let you know whether it's working or not.
– Shubham Singh
Nov 25 '18 at 4:02
1
Thanks and yes it works!
– Shubham Singh
Nov 28 '18 at 12:15
add a comment |
I am not an oracle expert but this could also work
SELECT *
FROM xyz
WHERE xdate IN (:businessDate - 1, :businessDate - 2, :businessDate - 3, :businessDate - 4, :businessDate - 5, :businessDate - 6, :businessDate - 7) AND MOD(TO_CHAR(xdate, 'J'), 7) + 1 NOT IN (6, 7);
Thank you for your suggestion
– Shubham Singh
Nov 28 '18 at 12:16
add a comment |
I would do:
select * from xyz
where xdate >= TO_DATE( :businessDate, 'yyyymmdd' ) - 7
and to_char( xdate, 'DAY' ) not in ( 'SAT', 'SUN' )
That's assuming you're working in an English database. That should give you the past 7 days worth, but exclude weekends.
Thank you for your suggestions
– Shubham Singh
Nov 28 '18 at 12:16
add a comment |
You'll need to do something like the following:
WITH cteData AS (SELECT TO_DATE(:BUSINESSDATE, 'YYYYMMDD') AS BUSINESS_DATE FROM DUAL)
SELECT *
FROM XYZ x
CROSS JOIN cteData d
WHERE TRUNC(x.XDATE) BETWEEN d.BUSINESS_DATE - 7
AND d.BUSINESS_DATE AND
TRUNC(x.XDATE) - TRUNC(x.XDATE, 'IW') <= 4
Thank you for your suggestions...
– Shubham Singh
Nov 28 '18 at 12:16
add a comment |
Find out the weekend day i.e. Sunday or Saturday by using 'DAY' format in format_date function e.g.
IF FORMAT_DATE(Date,'DAY')='SATURDAY' then date-1
IF FORMAT_DATE(Date,'DAY')='SUNDAY' then date-2
You would get only 5 days record
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53451429%2fget-last-5-day-record-excluding-weekend-days%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
5 Answers
5
active
oldest
votes
5 Answers
5
active
oldest
votes
active
oldest
votes
active
oldest
votes
SELECT *
FROM xyz
WHERE
xdate >= TRUNC(SYSDATE) - 7 --last 7 days AND
TRUNC (xdate) - TRUNC (xdate, 'IW') NOT IN (5,6) --not sat or sun
Take the last 7 days data, and remove any data from saturday or sunday.
TRUNC (xdate) - TRUNC (xdate, 'IW')
returns a value between 0 and 6 inclusive. 0 is monday. This is not affected by NLS date settings because it uses the same region setting in both truncs, so regardless if the week starts on sunday or monday in your country, the result of the calc is the same
In any given 7 day period you have 5 week days and 2 weekend days
Note that this query assumes the table has no future dated data. If it does put a restriction that xdate must be less than sysdate
Thanks @caius jard for your valuable suggestions. I would love to try it out and let you know whether it's working or not.
– Shubham Singh
Nov 25 '18 at 4:02
1
Thanks and yes it works!
– Shubham Singh
Nov 28 '18 at 12:15
add a comment |
SELECT *
FROM xyz
WHERE
xdate >= TRUNC(SYSDATE) - 7 --last 7 days AND
TRUNC (xdate) - TRUNC (xdate, 'IW') NOT IN (5,6) --not sat or sun
Take the last 7 days data, and remove any data from saturday or sunday.
TRUNC (xdate) - TRUNC (xdate, 'IW')
returns a value between 0 and 6 inclusive. 0 is monday. This is not affected by NLS date settings because it uses the same region setting in both truncs, so regardless if the week starts on sunday or monday in your country, the result of the calc is the same
In any given 7 day period you have 5 week days and 2 weekend days
Note that this query assumes the table has no future dated data. If it does put a restriction that xdate must be less than sysdate
Thanks @caius jard for your valuable suggestions. I would love to try it out and let you know whether it's working or not.
– Shubham Singh
Nov 25 '18 at 4:02
1
Thanks and yes it works!
– Shubham Singh
Nov 28 '18 at 12:15
add a comment |
SELECT *
FROM xyz
WHERE
xdate >= TRUNC(SYSDATE) - 7 --last 7 days AND
TRUNC (xdate) - TRUNC (xdate, 'IW') NOT IN (5,6) --not sat or sun
Take the last 7 days data, and remove any data from saturday or sunday.
TRUNC (xdate) - TRUNC (xdate, 'IW')
returns a value between 0 and 6 inclusive. 0 is monday. This is not affected by NLS date settings because it uses the same region setting in both truncs, so regardless if the week starts on sunday or monday in your country, the result of the calc is the same
In any given 7 day period you have 5 week days and 2 weekend days
Note that this query assumes the table has no future dated data. If it does put a restriction that xdate must be less than sysdate
SELECT *
FROM xyz
WHERE
xdate >= TRUNC(SYSDATE) - 7 --last 7 days AND
TRUNC (xdate) - TRUNC (xdate, 'IW') NOT IN (5,6) --not sat or sun
Take the last 7 days data, and remove any data from saturday or sunday.
TRUNC (xdate) - TRUNC (xdate, 'IW')
returns a value between 0 and 6 inclusive. 0 is monday. This is not affected by NLS date settings because it uses the same region setting in both truncs, so regardless if the week starts on sunday or monday in your country, the result of the calc is the same
In any given 7 day period you have 5 week days and 2 weekend days
Note that this query assumes the table has no future dated data. If it does put a restriction that xdate must be less than sysdate
edited Nov 23 '18 at 18:52
answered Nov 23 '18 at 18:45
Caius JardCaius Jard
10.8k21138
10.8k21138
Thanks @caius jard for your valuable suggestions. I would love to try it out and let you know whether it's working or not.
– Shubham Singh
Nov 25 '18 at 4:02
1
Thanks and yes it works!
– Shubham Singh
Nov 28 '18 at 12:15
add a comment |
Thanks @caius jard for your valuable suggestions. I would love to try it out and let you know whether it's working or not.
– Shubham Singh
Nov 25 '18 at 4:02
1
Thanks and yes it works!
– Shubham Singh
Nov 28 '18 at 12:15
Thanks @caius jard for your valuable suggestions. I would love to try it out and let you know whether it's working or not.
– Shubham Singh
Nov 25 '18 at 4:02
Thanks @caius jard for your valuable suggestions. I would love to try it out and let you know whether it's working or not.
– Shubham Singh
Nov 25 '18 at 4:02
1
1
Thanks and yes it works!
– Shubham Singh
Nov 28 '18 at 12:15
Thanks and yes it works!
– Shubham Singh
Nov 28 '18 at 12:15
add a comment |
I am not an oracle expert but this could also work
SELECT *
FROM xyz
WHERE xdate IN (:businessDate - 1, :businessDate - 2, :businessDate - 3, :businessDate - 4, :businessDate - 5, :businessDate - 6, :businessDate - 7) AND MOD(TO_CHAR(xdate, 'J'), 7) + 1 NOT IN (6, 7);
Thank you for your suggestion
– Shubham Singh
Nov 28 '18 at 12:16
add a comment |
I am not an oracle expert but this could also work
SELECT *
FROM xyz
WHERE xdate IN (:businessDate - 1, :businessDate - 2, :businessDate - 3, :businessDate - 4, :businessDate - 5, :businessDate - 6, :businessDate - 7) AND MOD(TO_CHAR(xdate, 'J'), 7) + 1 NOT IN (6, 7);
Thank you for your suggestion
– Shubham Singh
Nov 28 '18 at 12:16
add a comment |
I am not an oracle expert but this could also work
SELECT *
FROM xyz
WHERE xdate IN (:businessDate - 1, :businessDate - 2, :businessDate - 3, :businessDate - 4, :businessDate - 5, :businessDate - 6, :businessDate - 7) AND MOD(TO_CHAR(xdate, 'J'), 7) + 1 NOT IN (6, 7);
I am not an oracle expert but this could also work
SELECT *
FROM xyz
WHERE xdate IN (:businessDate - 1, :businessDate - 2, :businessDate - 3, :businessDate - 4, :businessDate - 5, :businessDate - 6, :businessDate - 7) AND MOD(TO_CHAR(xdate, 'J'), 7) + 1 NOT IN (6, 7);
answered Nov 23 '18 at 18:47
irfandarirfandar
1,0421016
1,0421016
Thank you for your suggestion
– Shubham Singh
Nov 28 '18 at 12:16
add a comment |
Thank you for your suggestion
– Shubham Singh
Nov 28 '18 at 12:16
Thank you for your suggestion
– Shubham Singh
Nov 28 '18 at 12:16
Thank you for your suggestion
– Shubham Singh
Nov 28 '18 at 12:16
add a comment |
I would do:
select * from xyz
where xdate >= TO_DATE( :businessDate, 'yyyymmdd' ) - 7
and to_char( xdate, 'DAY' ) not in ( 'SAT', 'SUN' )
That's assuming you're working in an English database. That should give you the past 7 days worth, but exclude weekends.
Thank you for your suggestions
– Shubham Singh
Nov 28 '18 at 12:16
add a comment |
I would do:
select * from xyz
where xdate >= TO_DATE( :businessDate, 'yyyymmdd' ) - 7
and to_char( xdate, 'DAY' ) not in ( 'SAT', 'SUN' )
That's assuming you're working in an English database. That should give you the past 7 days worth, but exclude weekends.
Thank you for your suggestions
– Shubham Singh
Nov 28 '18 at 12:16
add a comment |
I would do:
select * from xyz
where xdate >= TO_DATE( :businessDate, 'yyyymmdd' ) - 7
and to_char( xdate, 'DAY' ) not in ( 'SAT', 'SUN' )
That's assuming you're working in an English database. That should give you the past 7 days worth, but exclude weekends.
I would do:
select * from xyz
where xdate >= TO_DATE( :businessDate, 'yyyymmdd' ) - 7
and to_char( xdate, 'DAY' ) not in ( 'SAT', 'SUN' )
That's assuming you're working in an English database. That should give you the past 7 days worth, but exclude weekends.
answered Nov 23 '18 at 21:06
eaolsoneaolson
8,20663145
8,20663145
Thank you for your suggestions
– Shubham Singh
Nov 28 '18 at 12:16
add a comment |
Thank you for your suggestions
– Shubham Singh
Nov 28 '18 at 12:16
Thank you for your suggestions
– Shubham Singh
Nov 28 '18 at 12:16
Thank you for your suggestions
– Shubham Singh
Nov 28 '18 at 12:16
add a comment |
You'll need to do something like the following:
WITH cteData AS (SELECT TO_DATE(:BUSINESSDATE, 'YYYYMMDD') AS BUSINESS_DATE FROM DUAL)
SELECT *
FROM XYZ x
CROSS JOIN cteData d
WHERE TRUNC(x.XDATE) BETWEEN d.BUSINESS_DATE - 7
AND d.BUSINESS_DATE AND
TRUNC(x.XDATE) - TRUNC(x.XDATE, 'IW') <= 4
Thank you for your suggestions...
– Shubham Singh
Nov 28 '18 at 12:16
add a comment |
You'll need to do something like the following:
WITH cteData AS (SELECT TO_DATE(:BUSINESSDATE, 'YYYYMMDD') AS BUSINESS_DATE FROM DUAL)
SELECT *
FROM XYZ x
CROSS JOIN cteData d
WHERE TRUNC(x.XDATE) BETWEEN d.BUSINESS_DATE - 7
AND d.BUSINESS_DATE AND
TRUNC(x.XDATE) - TRUNC(x.XDATE, 'IW') <= 4
Thank you for your suggestions...
– Shubham Singh
Nov 28 '18 at 12:16
add a comment |
You'll need to do something like the following:
WITH cteData AS (SELECT TO_DATE(:BUSINESSDATE, 'YYYYMMDD') AS BUSINESS_DATE FROM DUAL)
SELECT *
FROM XYZ x
CROSS JOIN cteData d
WHERE TRUNC(x.XDATE) BETWEEN d.BUSINESS_DATE - 7
AND d.BUSINESS_DATE AND
TRUNC(x.XDATE) - TRUNC(x.XDATE, 'IW') <= 4
You'll need to do something like the following:
WITH cteData AS (SELECT TO_DATE(:BUSINESSDATE, 'YYYYMMDD') AS BUSINESS_DATE FROM DUAL)
SELECT *
FROM XYZ x
CROSS JOIN cteData d
WHERE TRUNC(x.XDATE) BETWEEN d.BUSINESS_DATE - 7
AND d.BUSINESS_DATE AND
TRUNC(x.XDATE) - TRUNC(x.XDATE, 'IW') <= 4
answered Nov 23 '18 at 23:41
Bob JarvisBob Jarvis
34k55785
34k55785
Thank you for your suggestions...
– Shubham Singh
Nov 28 '18 at 12:16
add a comment |
Thank you for your suggestions...
– Shubham Singh
Nov 28 '18 at 12:16
Thank you for your suggestions...
– Shubham Singh
Nov 28 '18 at 12:16
Thank you for your suggestions...
– Shubham Singh
Nov 28 '18 at 12:16
add a comment |
Find out the weekend day i.e. Sunday or Saturday by using 'DAY' format in format_date function e.g.
IF FORMAT_DATE(Date,'DAY')='SATURDAY' then date-1
IF FORMAT_DATE(Date,'DAY')='SUNDAY' then date-2
You would get only 5 days record
add a comment |
Find out the weekend day i.e. Sunday or Saturday by using 'DAY' format in format_date function e.g.
IF FORMAT_DATE(Date,'DAY')='SATURDAY' then date-1
IF FORMAT_DATE(Date,'DAY')='SUNDAY' then date-2
You would get only 5 days record
add a comment |
Find out the weekend day i.e. Sunday or Saturday by using 'DAY' format in format_date function e.g.
IF FORMAT_DATE(Date,'DAY')='SATURDAY' then date-1
IF FORMAT_DATE(Date,'DAY')='SUNDAY' then date-2
You would get only 5 days record
Find out the weekend day i.e. Sunday or Saturday by using 'DAY' format in format_date function e.g.
IF FORMAT_DATE(Date,'DAY')='SATURDAY' then date-1
IF FORMAT_DATE(Date,'DAY')='SUNDAY' then date-2
You would get only 5 days record
edited Nov 25 '18 at 0:48
Nick
26.1k111836
26.1k111836
answered Nov 24 '18 at 15:57
Deepak KulethaDeepak Kuletha
1
1
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53451429%2fget-last-5-day-record-excluding-weekend-days%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Date=. I don't think that could bei what you are searching
– bummi
Nov 23 '18 at 18:31
Sorry I didn't understood what you're saying
– Shubham Singh
Nov 23 '18 at 18:36
Select * from xyz where xdate=:businessDate - 5 and to_char(:businessDate,'DAY') NOT LIKE 'S%'
– Himanshu Ahuja
Nov 23 '18 at 18:44
@HimanshuAhuja thank you for your quick answer. I want to highlight businessDate is in format of yyyymmdd format. Will that work in your provided solution?
– Shubham Singh
Nov 23 '18 at 18:52
@HimanshuAhuja and when this program gets installed in an oracle db in france, where sunday is "dimanche", and the logic falls apart?
– Caius Jard
Nov 23 '18 at 18:54