Find Missing Page numbers in oracle

This code will return the missing page no between 1801 to 2000


select min_a - 1 + level
     from ( 
        SELECT 1801 min_a,
          2000 max_a
        FROM APEX_APPLICATION_PAGES
        WHERE application_id= :app_id
        and page_id between 1801 and 2000
          )
  connect by level <= max_a - min_a + 1
    minus
 select page_id from APEX_APPLICATION_PAGES where application_id =:app_id
and page_id between 1801 and 2000

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s