Doubt Bring Specific Date - Oracle

Asked

Viewed 40 times

-1

In the query below is bringing this way.

Data Inicial      Data Final      Dia da Semana

16/10/18          30/10/2018           3

Where that initial and final date is a specific period and the day of the week in that case is 3 = Tuesday. I was wondering if you had any queries you could bring in the form below.

For example, within this period there are 3 Tuesdays which are the days.

16/10/2018
23/10/2018
30/10/2018

1 answer

0


Create a precedent and pass the values by parameter p_data_ini and p_data_fim

select data from
(select to_date(:p_data_ini) + level - 1 data from dual 
connect by level <= (to_date(:p_data_fim) - to_date(:p_data_ini) + 1))
where to_char(to_date(data),'d') = 3

Browser other questions tagged

You are not signed in. Login or sign up in order to post.