Thursday, May 11, 2023

Range of Transaction number



SELECT COUNTROW, MIN(Lvl) starting_val, MAX(Lvl) end_value
  FROM (SELECT LEVEL Lvl,
               ceil(ROW_NUMBER() OVER(order by 1 desc) / 5) countrow
          FROM DUAL
        CONNECT BY LEVEL < 21)
 GROUP BY COUNTROW
 order by 1

select min(trx_number) lb,max(trx_number) ub
from (select trx_number,trx_number- row_number() over(order by trx_number) rn
from ra_customer_trx_all a , ra_cust_trx_types_all b,fnd_user c
where printing_option = 'PRI'
and a.cust_trx_type_id = B.CUST_TRX_TYPE_ID
and a.org_id = b.org_id
and b.type = 'INV'
and c.user_id = a.last_updated_by
and A.PRINTING_PENDING = 'N'
and a.org_id = 3842
--       and printing_count >= 1
and trx_date between '01-JAN-2024' and '30-JAN-2024')
group by rn
order by 1;    

No comments:

Post a Comment

EBS Order Holds details and release responsibility

  SELECT ooh.order_number,                  ooh.ordered_date,                 ooh.flow_status_code,                 ooh.credit_card_approval...