编译报错 求助各位大牛。。!!

a359945371 2012-07-27 04:15:43
create or replace
package body set_pass_rate_pkg
is
create or replace procedure main1(
p_pass_rate in number,
p_class_id in number,
p_course_name in varchar2
)
is
CURSOR get_adjust_cur(p_adjust_cnt number)
is
select tt.row_id
from(
select wst.rowid row_id,ws.class_id,ws.student_id,ws.student_name,
wct.course_id,wct.course_name,wst.score,
case when wst.score-60<0
then
rank()over(partition by
case when wst.score-60>=0
then null
else 'A'
end order by wst.score desc)
end adjust_flag
from wl_student_tab ws, wl_course_tab wct, wl_score_tab wst
where ws.class_id=p_class_id and wct.course_id=(select wl_course_tab.course_id
from wl_course_tab
where wl_course_tab.course_name=p_course_name)
) tt
where tt.adjust_flag<=p_adjust_cnt; --游标是项目的固定写法 有点长 但是完全没有错误
--------------------------------------------------------------------------
begin
select count(*) into In_total_cnt
from wl_score_tab wst, wl_student_tab ws
where ws.class_id=p_class_id and wst.course_id=(
select course_id from wl_course_tab where course_name=p_course_name);
--------------------------------------------------------------------------
if(In_total_cnt=0)
then
RAISE normal_expt;
end if;
--------------------------------------------------------------------------
select count(*) into In_pass_cnt
from wl_score_tab wst, wl_student_tab ws
where ws.class_id=p_class_id and wst.course_id=(
select course_id from wl_course_tab where course_name=p_course_name)
and wst.score-60>=0;

In_pass_rate := round (In_pass_cnt/In_total_cnt*100,2);
--------------------------------------------------------------------------
if(In_pass_rate>=p_pass_rate) then
RAISE normal_expt;
else
In_adjust_cnt:= ceil((p_pass_rate-In_pass_rate)*In_total_cnt/100);
end if;

--------------------------------------------------------------------------
open get_adjust_cur(In_adjust_cnt);
fetch get_adjust_cur bulk COLLECT into lt_adjust;
close get_adjust_cur;
--------------------------------------------------------------------------
forall i in 1..lt_adjust.count
update wl_score_tab wst
set wst.score=60
where wst.rowid=lt_adjust(i)
returning wst.student_id,wst.course_id bulk collect into lt_student,lt_course;
--------------------------------------------------------------------------
for i in lt_student.first..lt_student.last
loop
if(i=lt_student.first)
then
dbms_output.put_line('UPDATED RECORD LIST:');
end if;
dbms_output.put_line('STUDENT_ID:'||TO_CHAR(lt_student(i))||'COURSE_ID'||TO_CHAR(lt_course(i)));
end loop;
--------------------------------------------------------------------------
exception
when normal_expt then
dbms_output.putline('Data need not adjust');
end main1;


end set_pass_rate_pkg

包里建了个存储过程 然后过程里放了个游标,然后就报错了 逻辑没什么错误, 就是不知道哪里少写什么东西了!!
请各位大神帮看下,下面是错误提示

Error(4,5): PLS-00103: Encountered the symbol "CREATE" when expecting one of the following: begin end function pragma procedure subtype type <an identifier> <a double-quoted delimited-identifier> current cursor delete exists prior
...全文
140 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
yuyu1980 2012-07-27
  • 打赏
  • 举报
回复
create or replace
package body set_pass_rate_pkg
is
create or replace procedure main1(

包中的过程不能写create or replace
应该为下边:
create or replace
package body set_pass_rate_pkg
is
procedure main1(

1,617

社区成员

发帖
与我相关
我的任务
社区描述
Oracle 非技术区
社区管理员
  • 非技术区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧