View difference between Paste ID: J375t0ak and nnqXMFX5
SHOW: | | - or go back to the newest paste.
1-
INSERT INTO TMP_TXN ......
1+
INSERT INTO TMP_TXN ......
2-
SELECT .......
2+
SELECT .......
3-
  FROM TXN (160m rows), CUSTOMERS (1m rows), PRODUCTS (1k rows)
3+
  FROM TXN (160m rows), CUSTOMERS (1m rows), PRODUCTS (1k rows)
4-
 WHERE TXN.TXN_DATE = p_date 
4+
 WHERE TXN.TXN_DATE = p_date 
5-
   AND TXN.TXN_AMOUNT > 0 
5+
   AND TXN.TXN_AMOUNT > 0 
6-
   AND TXN.PRODUCT_ID = PRODUCTS.PRODUCT_ID 
6+
   AND TXN.PRODUCT_ID = PRODUCTS.PRODUCT_ID 
7-
   AND PRODUCTS.PRODTYPE_ID IN ('1', '12', '13');
7+
   AND PRODUCTS.PRODTYPE_ID IN ('1', '12', '13');
8-
   AND TXN.CUSTOMER_ID = CUSTOMERS.CUSTOMER_ID 
8+
   AND TXN.CUSTOMER_ID = CUSTOMERS.CUSTOMER_ID 
9
   AND CUSTOMERS.CUSTOMER_STATUS LIKE 'A%'
10
	
11-
FOR item IN (SELECT .....
11+
FOR item IN (SELECT .....
12-
              FROM TXN (160m rows), CUSTOMERS (1m rows), PRODUCTS (1k rows)
12+
              FROM TXN (160m rows), CUSTOMERS (1m rows), PRODUCTS (1k rows)
13-
              WHERE TXN.CUSTOMER_ID = CUSTOMERS.CUSTOMER_ID
13+
              WHERE TXN.CUSTOMER_ID = CUSTOMERS.CUSTOMER_ID
14-
                AND CUSTOMERS.CUSTOMER_STATUS LIKE 'A%'
14+
                AND CUSTOMERS.CUSTOMER_STATUS LIKE 'A%'
15-
                AND TXN.PRODUCT_ID = PRODUCTS.PRODUCT_ID
15+
                AND TXN.PRODUCT_ID = PRODUCTS.PRODUCT_ID
16-
                AND PRODUCTS.PRODTYPE_ID IN ('1', '12', '13')
16+
                AND PRODUCTS.PRODTYPE_ID IN ('1', '12', '13')
17-
                AND TXN.TXN_DATE = p_date
17+
                AND TXN.TXN_DATE = p_date
18-
                AND TXN.TXN_AMOUNT > 0
18+
                AND TXN.TXN_AMOUNT > 0
19-
              ORDER BY CUSTOMER_ID);
19+
              ORDER BY CUSTOMER_ID);
20-
  LOOP         
20+
  LOOP         
21-
     IF item.customer_id <> customer_id_old THEN
21+
     IF item.customer_id <> customer_id_old THEN
22
     etc.