Guest User

Untitled

a guest
Nov 5th, 2017
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. INSERT INTO TMP_TXN ......
  2. SELECT .......
  3. FROM TXN (160m rows), CUSTOMERS (1m rows), PRODUCTS (1k rows)
  4. WHERE TXN.TXN_DATE = p_date
  5. AND TXN.TXN_AMOUNT > 0
  6. AND TXN.PRODUCT_ID = PRODUCTS.PRODUCT_ID
  7. AND PRODUCTS.PRODTYPE_ID IN ('1', '12', '13');
  8. AND TXN.CUSTOMER_ID = CUSTOMERS.CUSTOMER_ID
  9. AND CUSTOMERS.CUSTOMER_STATUS LIKE 'A%'
  10.  
  11. FOR item IN (SELECT .....
  12. FROM TXN (160m rows), CUSTOMERS (1m rows), PRODUCTS (1k rows)
  13. WHERE TXN.CUSTOMER_ID = CUSTOMERS.CUSTOMER_ID
  14. AND CUSTOMERS.CUSTOMER_STATUS LIKE 'A%'
  15. AND TXN.PRODUCT_ID = PRODUCTS.PRODUCT_ID
  16. AND PRODUCTS.PRODTYPE_ID IN ('1', '12', '13')
  17. AND TXN.TXN_DATE = p_date
  18. AND TXN.TXN_AMOUNT > 0
  19. ORDER BY CUSTOMER_ID);
  20. LOOP
  21. IF item.customer_id <> customer_id_old THEN
  22. etc.
Add Comment
Please, Sign In to add comment