第一次写存储过程,到了一个这样的错误:PLS-00103: Encountered the symbol "(" when expecting one of the following:   , from
存储过程代码如下
CREATE OR REPLACE PROCEDURE "PROCEDURE_ORDER_SCORE" as
examid      number;
studentid   number;
cursor cgorder is  select studentexam.exam_course_id as courseId, studentexam.student_id as studentId,studentexam.pm_class as classpm,studentexam.pm_grade as gradepm
from
(select
tablea.exam_course_id as exam_course_id, tablea.student_id as student_id,tablea.studentname as studentname,tablea.class_name as class_name,
tablea.name as name ,tablea.exam_ending as ending,
rank() over ( partition by tablea.code,tablea.class_id order by tablea.exam_ending desc) as pm_class,
rank() over ( partition by tablea.code order by tablea.exam_ending desc) as pm_grade
from 
(select d.exam_course_id as exam_course_id,d.student_id as student_id, d.studentname as studentname,
d.exam_ending as exam_ending,d.class_name as class_name,c.name as name,
d.class_id as class_id,e.name as grade_name,e.code as code
from 
exam_info a,
exam_result d,
exam_course_info b,
dm_kc c,
dm_njp e
where 
a.exam_info_id=b.exam_info_id 
and b.exam_course_id = d.exam_course_id
and b.course_code = c.code 
and a.exam_grade_code = e.code
and a.exam_info_id =examid
)  tablea
order by pm_grade
) studentexam
where studentexam.student_id = studentid;
cursor total is  select 
totalpm.exam_info_id as examId,totalpm.student_id as studentId,totalpm.pm_class as classpm,totalpm.pm_grade as gradepm
from
(select total.exam_info_id as exam_info_id, total.total_name as total_name, total.class_name as class_naem,
total.student_id as student_id,total.student_name as student_name,total.exam_total_score as exam_total_score,
rank() over (partition by total.code,total.class_id order by total.exam_total_score desc) as pm_class,
rank() over (partition by total.code order by total.exam_total_score desc) as pm_grade
from
(select d.exam_info_id as exam_info_id, d.total_name as total_name,d.student_id as student_id,
 d.student_name as student_name,d.exam_total_score as exam_total_score,d.class_name as class_name,d.class_id as class_id,e.name as grade_name,e.code as code
from 
exam_info a,
exam_totalresult d,
dm_njp e
where 
a.exam_info_id = d.exam_info_id
and a.exam_grade_code = e.code
and a.exam_info_id =examid
) total
order by pm_grade
) totalpm
where 
totalpm.student_id =studentid;
begin
  for temp in cgorder loop
  update exam_result set pm_class=temp.classpm,pm_grade=temp.gradepm where exam_course_id=temp.courseId and student_id=temp.studentId;
  end loop;
  commit;
  for temp in total
  update exam_totalresult set pm_class = temp.classpm,pm_grade= temp.gradepm where exam_info_id = temp.examId and student_id = temp.studentId;
  update exam_info set score_order='0' where exam_info_id=temp.examId;
  end loop;
  commit;
end;
在游标里面能否用分析函数?
我把游标中的sql语句拿出去执行没有问题
谢谢各位