declare
cursor cr1 is select Avgsalary
from (select E.grade,
E.TestLevel,
(select AA * 2 BB
from (select avg(Salarys) AA
from andy_shen_salary_information S)) Avgsalary
from andy_shen_emp_infomation E
where E.GRADE >= 5
and E.Grade <= 7
and E.TestLevel > 4);
i cr1%rowtype;
begin
open cr1;
for i in cr1 loop
select decode(AA,' ',i.Avgsalary),Salarys,salarymonth,Id from (select A.*, ' ' AA from andy_shen_salary_information A where Id in
(select empid from andy_shen_emp_infomation E where E.GRADE >= 5 and E.Grade <= 7 and E.Testlevel > 4)
and A.SALARYMONTH=6) where AA =' ';
end loop;
close cr1;
end;这段语句报ora-06550:line-22,column 4:
pls 00428:an INTO clause is expected in this SELECT statement的错误
求解!!!!OracleCursorselect
cursor cr1 is select Avgsalary
from (select E.grade,
E.TestLevel,
(select AA * 2 BB
from (select avg(Salarys) AA
from andy_shen_salary_information S)) Avgsalary
from andy_shen_emp_infomation E
where E.GRADE >= 5
and E.Grade <= 7
and E.TestLevel > 4);
i cr1%rowtype;
begin
open cr1;
for i in cr1 loop
select decode(AA,' ',i.Avgsalary),Salarys,salarymonth,Id from (select A.*, ' ' AA from andy_shen_salary_information A where Id in
(select empid from andy_shen_emp_infomation E where E.GRADE >= 5 and E.Grade <= 7 and E.Testlevel > 4)
and A.SALARYMONTH=6) where AA =' ';
end loop;
close cr1;
end;这段语句报ora-06550:line-22,column 4:
pls 00428:an INTO clause is expected in this SELECT statement的错误
求解!!!!OracleCursorselect
cursor cr1 is select Avgsalary
from (select E.grade,
E.TestLevel,
(select AA * 2 BB
from (select avg(Salarys) AA
from andy_shen_salary_information S)) Avgsalary
from andy_shen_emp_infomation E
where E.GRADE >= 5
and E.Grade <= 7
and E.TestLevel > 4);
i cr1%rowtype;
result1 number;
result2 number;
result3 number;
result4 number;begin
for i in cr1 loop
--dbms_output.put_line(i.Avgsalary);
select NewCell,Salarys,SalaryMonth,Id into result1,result2,result3,result4 from(select (decode(AA,' ',i.Avgsalary)) NewCell,Salarys,salarymonth,Id from
(select A.*, ' ' AA from andy_shen_salary_information A where Id in
(select empid from andy_shen_emp_infomation E where E.GRADE >= 5 and E.Grade <= 7 and E.Testlevel > 4)
and A.SALARYMONTH=6) where AA =' ');
end loop;
end;
现在加上into,他报ora-01422:exact fetch returns more than requested number of rows
ora-06512:at line 28求解!!!!!!!!
bulk collect
TYPE sallist IS TABLE OF employees.salary%TYPE;
sals sallist;
BEGIN
SELECT salary BULK COLLECT INTO sals
FROM employees
where rownum< 1000--接下来使用集合中的数据
END;