I tried to insert a calculated average from a table to another table writing the sql like below but it didnt work. Can someone please help me out ? how can I write it like a stored procedure in Oracle to cater for many states i.e. CA, IL, GA, WI
.... ?
INSERT INTO Employee(averageSalary, averageTax)
(SELECT AVG(Salary), AVG(Tax)
FROM HrDeptEmployee
WHERE State = 'NY')