oracle - SQL Insert calculated average value from another table -
i tried insert calculated average table table writing sql below didnt work. can please me out ? how can write stored procedure in oracle cater many states i.e. ca, il, ga, wi
.... ?
insert employee(averagesalary, averagetax) (select avg(salary), avg(tax) hrdeptemployee state = 'ny')
leave off parentheses around select, not subselect.
edit: second question in comment (error: null value of id column of target table):
add id insert select list (assuming want use id 1
):
insert employee(id, averagesalary, averagetax) select 1, avg(salary), avg(tax) hrdeptemployee state = 'ny'
Comments
Post a Comment