PL/SQL block to populate a table
Need help writing pl/sql to insert into table.
1. Write a PL/SQL block which will populate the RESULTS table as described below. Consider performance implications (specifically where would you commit the queries) as we are dealing with millions of records.
The PL/SQL will:
- insert into the RESULTS table each customer id, and the number of unique products purchased by that customer.
- update the recently_purchased column of the customer table to 'Y' (yes if they have purchased a product in the last 12 months) or 'N' (if they have not purchased a product in the last 12 months).
Listed below are the tables & definitions:
recently_purchased VARCHAR2(1) -- 'Y' or 'N'
columns: customer_id NUMBER, product_count NUMBER