Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- INSERT INTO TMP_TXN ......
- SELECT .......
- FROM TXN (160m rows), CUSTOMERS (1m rows), PRODUCTS (1k rows)
- WHERE TXN.TXN_DATE = p_date
- AND TXN.TXN_AMOUNT > 0
- AND TXN.PRODUCT_ID = PRODUCTS.PRODUCT_ID
- AND PRODUCTS.PRODTYPE_ID IN ('1', '12', '13');
- AND TXN.CUSTOMER_ID = CUSTOMERS.CUSTOMER_ID
- AND CUSTOMERS.CUSTOMER_STATUS LIKE 'A%'
- FOR item IN (SELECT .....
- FROM TXN (160m rows), CUSTOMERS (1m rows), PRODUCTS (1k rows)
- WHERE TXN.CUSTOMER_ID = CUSTOMERS.CUSTOMER_ID
- AND CUSTOMERS.CUSTOMER_STATUS LIKE 'A%'
- AND TXN.PRODUCT_ID = PRODUCTS.PRODUCT_ID
- AND PRODUCTS.PRODTYPE_ID IN ('1', '12', '13')
- AND TXN.TXN_DATE = p_date
- AND TXN.TXN_AMOUNT > 0
- ORDER BY CUSTOMER_ID);
- LOOP
- IF item.customer_id <> customer_id_old THEN
- etc.
Add Comment
Please, Sign In to add comment