Home > database >  ORACLE small white for help
ORACLE small white for help

Time:09-23

ORACLE using statement query data (not including Saturday, Sunday) three days before the query data in three days if including weekends, add a day or two, and the corresponding
Example 1: what day is it today 1 last week, so I need to check the data is on Saturday, Sunday, Friday, Thursday, Wednesday's data;
Example 2: if data query to week 5 Thursday today, Wednesday, Tuesday's data;
Here is not a single query

CodePudding user response:

Select * from t1 where trunc (rq) & gt;
(select case to_char (sysdate, 'd')
When (2 and 4) then in trunc (sysdate + 5)
When in (5, 6) then trunc (sysdate + 3)
When in (1) then trunc (sysdate + 4)
End the from dual)

CodePudding user response:

Idea is to use to_char (sysdate, 'd') takes the current is how many days this week, the weekend for the first day of the beginning

CodePudding user response:

Today is a few, decode, enumeration carted back again for several days,

CodePudding user response:

refer to the second floor baidu_36457652 response:
idea is to use to_char (sysdate, 'd') takes the current is how many days this week, the weekend for the first day, start
this statement lack of expression

CodePudding user response:

reference 4 floor qq_36038363 response:
Quote: refer to the second floor baidu_36457652 response:

Idea is to use to_char (sysdate, 'd') takes the current is how many days this week, weekend for the first day,
this statement lack expression


Select * from t1 where trunc (rq) & gt;
(select case when to_char (sysdate, 'd') in (2 and 4) then trunc (sysdate + 5)
Case the when to_char (sysdate, 'd') in (5, 6) then trunc (sysdate + 3)
The else trunc (sysdate + 4)
End the from dual)
  • Related