把
begin
score1:=50;
score2:=60;
stupro(score1,score2);
end;
放在create or replace ...前面是什么意思?
begin
score1:=50;
score2:=60;
stupro(score1,score2);
end;
放在create or replace ...前面是什么意思?
解决方案 »
- 左连接显示
- 关于数据库中date类型
- 不小心删除oracle9i里表,如何恢复表!!!!
- 在oracle中for in和游标执行效率一样吗?
- 新手: ASP报错: "TNS: 监听进程不能解析在连接描述符中给出的 SERVICE_NAME "
- dmp文件只有几百k,可是导入库后占用空间2G多!why?how to do?
- 触发器问题,急,在线等候
- ASP+ORACLE存储过程/包如何输出2个值???
- ORA-12560:TNS:协议适配器错误(help me!help me...(声音嘶哑))
- 不知道是数据问题还是DATASET问题,请大哥指教!
- 急:请问oracle中有没有sql server的自增自段和text类型,如果没有可以用什么代替呢?
- 急,有个sql语句写不出来,还望高手帮帮忙,指点一下!
1。Begin放在Create里面
2。Procedure不能AS,如果要有返回值,请改成Function。
你这是生写吗?也不看看语法书再写??
用于创建存储过程,编译时有错误吗?下面是运行存储过程
begin
score1:=50;
score2:=60;
stupro(score1,score2);
end;
存储过程编译如果没有问题,运行时有问题,就把过程贴出来看看。
把你的过程代码贴出来,大家就可以帮你找的原因了
噢!明白了,我试试!谢谢各位!
过程:create or replace procedure studpro(temp1 in system.student.yw%type,temp2 in system.student.sx%type,temptotalscore in system.result.totalscore%type) as
studentrecord system.student%rowtype;
studenttotalscore system.result.totalscore%type;
studentflag varcha2(4);
cursor studentcursor is select * from system.student;
eorromessage exception;
begin
open studentcursor;
if studentcursor%notfound then
raise errormessage;
end if;
loop
fetch studentcursor into studentrecord;
studenttotalscore:= studentrecord.yw+studentrecord.sx
if (studentrecord.yw>=temp1 and studentrecord.sx>=temp2) then
studentflag:='合格';
else
studentflag:='不合格';
end if;
exit when studentcursor%notfound;
insert into system.result(bh,xm,lb,yw,sx,totalscore.flag)
values(studentrecord.bh,studentrecord.xm,studentrecord.lb,studentrecord.yw,studentrecord.sx,studenttotalscore,studentflag);
end loop;
close studentcursor;
commit;
exception
when errormessage then
dbms_output.put_line('无法打开数据表!');
end;
raise errormessage;
end if;
一定不会发生的.此句是多余。
studentflag varcha2(4);---此句自怎能定义4字节呢,下面的长度就不够长度了,而且把varchar2(4)写错了。唉!SQL> set serveroutput on
SQL> declare
2 a varchar2(4):='不合格';
3 begin
4 dbms_output.put_line(a);
5 end;
6 /
ORA-06502: PL/SQL: 数字或值错误 : 字符串缓冲区太小
ORA-06512: 在line 2修改如下
studentflag varchar2(6);