Stored procedures 我们可以在oracle过程中使用%rowtype的数据类型作为out参数吗
PLS-00410:记录、表格或参数列表中的重复字段不可用 允许的Stored procedures 我们可以在oracle过程中使用%rowtype的数据类型作为out参数吗,stored-procedures,oracle11g,Stored Procedures,Oracle11g,PLS-00410:记录、表格或参数列表中的重复字段不可用 允许的 为什么在上面的代码中出现此错误您声明了一个名为p\u emp\u info的局部变量,但您有一个同名的out参数 你根本不需要那个局部变量;只需删除其声明 create or replace procedure find_emp_info ( p_emp_info out emp%rowtype, p_empno in emp.empno%type default 7839 ) is p_emp_info
为什么在上面的代码中出现此错误您声明了一个名为
p\u emp\u info
的局部变量,但您有一个同名的out参数
你根本不需要那个局部变量;只需删除其声明
create or replace
procedure find_emp_info (
p_emp_info out emp%rowtype,
p_empno in emp.empno%type default 7839
)
is
p_emp_info emp%rowtype;
begin
select * into emp_info
from emp
where empno =p_empno;
exception
when no_data_fount then
dbms_output.put_line( 'enter employee number not exists');
when others then
dbms_output.put_line('ERROR OCCURS ') ;
RAISE_APPLICATION_ERROR (-20003,SQLCODE||CHR(10)||sqlerrm);
end find_emp_info ;
/
正如@Alex提到的,有两个错误,您在变量
p\u emp\u info
中声明了一个局部变量,该变量可以删除
您使用的例外情况是no\u data\u fount
,它必须是no\u data\u found
create or replace
procedure find_emp_info (
p_emp_info out emp%rowtype,
p_empno in emp.empno%type default 7839
)
is
begin
select * into emp_info
from emp
...
create or replace
procedure find_emp_info (
p_emp_info out emp%rowtype,
p_empno in emp.empno%type default 7839
)
is
begin
select * into p_emp_info
from emp
where empno =p_empno;
exception
when no_data_found then
dbms_output.put_line( 'enter employee number not exists');
when others then
dbms_output.put_line('ERROR OCCURS ') ;
RAISE_APPLICATION_ERROR (-20003,SQLCODE||CHR(10)||sqlerrm);
end find_emp_info ;
/