Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CURSOR curs IS
- SELECT cust_id--,COUNT(cust_id) AS num_ocurrences
- FROM trab.sales
- GROUP BY cust_id
- HAVING ( COUNT(cust_id)>=1 )
- ORDER BY cust_id;
- last_sale DATE;
- BEGIN
- FOR cs IN curs
- LOOP
- SELECT MAX(sale_date)INTO last_date FROM trab.sales s WHERE s.cust_id= cs.cust_id;
- UPDATE indw.CLIENTS aux_t SET aux_t.CLIENT_LAST_BUY = last_date
- WHERE aux_t.CLIENT_ID_SRC = cs.CUST_ID;
- END LOOP;
- END;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement