title: How to find missing Number along with the numbers present in table in Oracle
body: <p>I am trying to fetch data for one of my clients, but there are missing tokens in his data. I tried the below query for fetching the missing data and inserting into one dump table, but would like to find a more optimized way where I find the missing tokens along with the token's present in the table.</p>
  <pre><code>SELECT MinToken + 1 Level 
   FROM (SELECT Min(Token) AS MINTOKEN,  MAX(Token) AS MAXTOKEN
           FROM dmp_SellerOrders 
          Where OrderNo = 1
            AND TradeDate = '27-Oct-20')
  CONNECT BY LEVEL &lt; MAXTOKEN - MINTOKEN
  MINUS
  SELECT TOKEN 
    FROM dmp_SellerOrders
   Where (OrderNo, TranserialNo) IN (SELECT OrderNo, MAX(TranserialNo) 
                                       FROM dmp_SellerOrders 
                                     GROUP BY OrderNo)
     AND TradeDate = '27-Oct-20';
  </code></pre>
  <p>Actual Data in Table looks like this,</p>
  <pre><code>Original Order  OrderNo TranserialNo    Token   Qty Price
                     1    1               25      100 100
                     1    1               26      100 100
                     1    1               27      100 100
                     1    1               28      100 100
                     1    1               30      100 100
                     1    1               31      100 100
  
  Order Price Modified  OrderNo TranserialNo  Token    Qty    Price
                        1       2             25       100    200
                        1       2             26       100    200
                        1       2             27       100    200
                        1       2             28       100    200
                        1       2             30       100    200
                        1       2             31       100    200
  </code></pre>
  <p>I need data to show by grouping Qty, as show below,</p>
  <pre><code>OrderNo      MinToken      MaxToken      Qty  Price
  1             25            28           100  200
  1             29            29           0    0 
  1             30            31           100  200
  </code></pre>
  <p>But if I group qty then I get below out,</p>
  <pre><code>OrderNo      MinToken      MaxToken      Qty  Price
  1             25            31           100  200
  1             29            29           0    0 
  </code></pre>
  <p>Can any one please help me, how can I get the output as expected.</p>
  <p>Regards,
  Mehul</p>