Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Analytic Function to count rows in a date range

Lothar FlatzMar 30 2023

Suppose this table

create table test (
Id Number,
search_date date,
start_date date
End_date date);

Is it possible to write an analytic function that for every row counts all rows where the search_date of the current row is in the range of start_date and End_date? The current row should be skipped in the count.

The data is rather random, the only prerequesit is that start_date < End_date for each row.

Comments
Post Details
Added on Mar 30 2023
23 comments
1,948 views