创建存储过程的时候没有报错,如下:
create procedure classifiedQuery (p_cur out sys_refcursor, input varchar)
as
begin
open p_cur for select * from book where kind = input;
exception
when no_data_found then
dbms_output.put_line('无搜索结果');
end;调用:
call procedure classifiedQuery ('教材');报错:
在行 1 上开始执行命令时出错:
call procedure classifiedQuery ('教材')
错误报告:
SQL 错误: ORA-06576: 不是有效的函数或过程名
初学者,求指导,谢谢各位!
create procedure classifiedQuery (p_cur out sys_refcursor, input varchar)
as
begin
open p_cur for select * from book where kind = input;
exception
when no_data_found then
dbms_output.put_line('无搜索结果');
end;调用:
call procedure classifiedQuery ('教材');报错:
在行 1 上开始执行命令时出错:
call procedure classifiedQuery ('教材')
错误报告:
SQL 错误: ORA-06576: 不是有效的函数或过程名
初学者,求指导,谢谢各位!
输入:call classifiedQuery('教材');报错:调用 'CLASSIFIEDQUERY' 时参数个数或类型错误是因为之前创建过程里有个p_cur out sys_refcursor参数吗……这个应该输什么呢
OUTPARM OUT VARCHAR2) IS
BEGIN
OUTPARM := 123;
DBMS_OUTPUT.PUT_LINE(OUTPARM);
END TEST;
SET SERVEROUTPUT ON ;
DECLARE
OUTPARM VARCHAR2(255);
BEGIN
TEST('123', OUTPARM);
END;
/当过程中含有输出参数时,调用时必须通过BEGIN END块,不能通过EXEC或CALL调用;
但我想输出的是select * from book,这个查询结果可以直接保存在变量里吗?
输入:call classifiedQuery('教材');报错:调用 'CLASSIFIEDQUERY' 时参数个数或类型错误是因为之前创建过程里有个p_cur out sys_refcursor参数吗……这个应该输什么呢
你有两个参数,并且是输入输出的,所有个数不对。
如4楼。
但我想输出的是select * from book,这个查询结果可以直接保存在变量里吗?
你这样写的话,*就只有一个字段,不然还是报错。