Search
 
SCRIPT & CODE EXAMPLE
 

SQL

how to calculate number of days between two dates excluding weekends in oracle

-- All dates between 01/07/2021 and 15/07/2021 excluding weekends
SELECT CAL_DATE
FROM (
         SELECT to_date('01/07/2021', 'DD/MM/YYYY') + ROWNUM - 1 AS CAL_DATE
         FROM ALL_OBJECTS
         WHERE ROWNUM <= to_date('15/07/2021', 'DD/MM/YYYY') 
                             - to_date('01/07/2021', 'DD/MM/YYYY') + 1)
WHERE to_char(CAL_DATE, 'DY', 'NLS_DATE_LANGUAGE=AMERICAN') NOT IN ('SAT', 'SUN');
Comment

PREVIOUS NEXT
Code Example
Sql :: mysql ip address data type 
Sql :: replace null in sql 
Sql :: group_concat in mysql 
Sql :: sql create view 
Sql :: how to check table exists or not in postgresql 
Sql :: date conversion in mysql column 
Sql :: SQLSTATE[42000]: Syntax error or access violation: 1075 Incorrect table definition; there can be only one auto column and it must be defined as a key" 
Sql :: mysql group by range 
Sql :: postgre describe table 
Sql :: oracle add time to date 
Sql :: how to check table lock 
Sql :: oracle apex warn on unsaved changes 
Sql :: restroe pg_dump example 
Sql :: install mysql on ubuntu 
Sql :: t-sql create trigger 
Sql :: add colum date in sql 
Sql :: The local psql command could not be located 
Sql :: db.relationship sqlalchemy flask 
Sql :: json extract 
Sql :: Parsing XML IN SQL Server 
Sql :: mysql permissions 
Sql :: mysql stored procedure vs function 
Sql :: postgresql delete multiple rows 
Sql :: host 127.0 0.1 is not allowed to connect to this mysql server 
Sql :: sql server create constraint 
Sql :: postgresql grant owner to user 
Sql :: sql change data type 
Sql :: FIND AVERAGE SALARY EARNER IN SQL 
Sql :: change column data type sql 
Sql :: subquery in sql 
ADD CONTENT
Topic
Content
Source link
Name
7+6 =