oracle执行存储过程问题
createorreplaceproceduremymdm.shujvtest(idininnumber,numinnumber,resultsoutsys_refcur...
create or replace procedure mymdm.shujvtest(idin in number,num in number,results out sys_refcursor) as
id number;
con varchar2(20);
addid number;
begin
select nvl(max(id),0)+1 into id from mymdm.shujv_test;
addid:=1;
while addid<=idin loop
while nvl(length(con),0)<num loop
con:=con||chr(ceil(dbms_random.value(20,126)));
end loop;
insert into mymdm.shujv_test values(id,con);
id:=id+1;
addid:=addid+1;
con:=null;
end loop;
commit;
open results for select * from mymdm.shujv_test where rownum<=20;
end;
这是我的存储过程源码,然后我去调用存储过程
第一种:
SQL> exec shujvtest(10000,20,results);
begin shujvtest(10000,20,results); end;
ORA-06550: line 2, column 26:
PLS-00201: identifier 'RESULTS' must be declared
ORA-06550: line 2, column 7:
PL/SQL: Statement ignored
第二种:
SQL> exec shujvtest(10000,20);
begin shujvtest(10000,20); end;
ORA-06550: line 2, column 7:
PLS-00306: wrong number or types of arguments in call to 'SHUJVTEST'
ORA-06550: line 2, column 7:
PL/SQL: Statement ignored
问一下存储过程调用不是这样的么,为什么报错啊 展开
id number;
con varchar2(20);
addid number;
begin
select nvl(max(id),0)+1 into id from mymdm.shujv_test;
addid:=1;
while addid<=idin loop
while nvl(length(con),0)<num loop
con:=con||chr(ceil(dbms_random.value(20,126)));
end loop;
insert into mymdm.shujv_test values(id,con);
id:=id+1;
addid:=addid+1;
con:=null;
end loop;
commit;
open results for select * from mymdm.shujv_test where rownum<=20;
end;
这是我的存储过程源码,然后我去调用存储过程
第一种:
SQL> exec shujvtest(10000,20,results);
begin shujvtest(10000,20,results); end;
ORA-06550: line 2, column 26:
PLS-00201: identifier 'RESULTS' must be declared
ORA-06550: line 2, column 7:
PL/SQL: Statement ignored
第二种:
SQL> exec shujvtest(10000,20);
begin shujvtest(10000,20); end;
ORA-06550: line 2, column 7:
PLS-00306: wrong number or types of arguments in call to 'SHUJVTEST'
ORA-06550: line 2, column 7:
PL/SQL: Statement ignored
问一下存储过程调用不是这样的么,为什么报错啊 展开
展开全部
输出参数需要定义。
declare
results sys_refcursor;
begin
hujvtest(10000,20,results);
end;
declare
results sys_refcursor;
begin
hujvtest(10000,20,results);
end;
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
SQL> exec shujvtest(10000,20,results); 中的results 要先声明为 你定义的游标才能用。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询