程序已创建但未执行

时间:2016-12-09 04:28:41

标签: sql oracle

create or replace procedure para_cursor_exe as 
cursor c_p_det(tar_val number) is select name, salary from fees where salary < tar_val;
nname varchar2(30);
ssalary number(5);

begin 
<<block_exe>>
begin
Open c_p_det(&tar_val);
LOOP
FETCH c_p_det into nname, ssalary;
DBMS_OUTPUT.PUT_LINE('NAME : ' || NNAME || ' :::: SALARY : ' || SSALARY);
EXIT WHEN C_P_DET%NOTFOUND;
END LOOP;
CLOSE C_P_DET;
end;

execute immediate ' block_exe ' ;
dbms_output.put_line('done processing !!');

end;
/  

SQL> @para_cursor_exe.sql;
Enter value for tar_val: 1000
old   9:  Open c_p_det(&tar_val);
new   9:  Open c_p_det(1000);

Procedure created.

程序已编译但在通话时会出现如下错误

SQL> call para_cursor_exe;
call para_cursor_exe
 *
ERROR at line 1:
ORA-06576: not a valid function or procedure name

我想为不同的目标值动态处理过程,这些目标值应该在运行时传递给游标。我怎么称呼它或逻辑错误?

1 个答案:

答案 0 :(得分:1)

错误指出调用不是有效的函数或过程名称。

create or replace procedure p as begin null; end;
/

使用带括号的调用 - ()

call p();

或者根本不使用致电

begin
    p;
end;