trying to get total sales for a specific zip; I have done a couple of these, but cant seem to get the total and I'm missing something.
Tables are Customers that has the zip, sales that has the gross sale amount.
This one executes complete but no total; so what am I missing?
Also for the sake of asking how could I modify this to ask me in an interface, where I can input the zip? I started that too but; again, I get the question when I insert the zip it gives me errors.
SET SERVEROUTPUT ON
DECLARE
V_SALES NUMBER (10,2);
V_ZIP VARCHAR2(5) NOT NULL := 48228;
BEGIN
SELECT SUM(S.GROSS_SALE_PRICE) -- GROUP FUNCTION
INTO V_SALES
FROM SALES S
WHERE CUST_ID = V_ZIP;
DBMS_OUTPUT.PUT_LINE ('TOTAL SALES FOR ZIP 48228, IS'|| TO_NUMBER(V_SALES));
END;
/