定义了一个存储过程;
create or replace procedure FindBaseInfo(
v_id in out number,
v_name out varchar2,
v_title out varchar2
)is
temp integer(2);
begin
select count(*) into temp from employee where id=v_id;
if temp>0 then
select id,name,title into v_id,v_name,v_title from employee where id=v_id;
dbms_output.put_line('succeed!');
else
v_id:=0;
dbms_output.put_line('failed!');
end if;
end;调用过程如下:DECLARE
a number ;
b varchar2(10);
c varchar2(10);
begin
a:=&a;
FindBaseInfo(a,b,c);
end;这样写的话a输入1是可以运行的。但是为什么我改成FindBaseInfo(1,b,c)之后就报错了呢,难道plsql存储过程不允许在调用过程中直接赋值给参数吗?
create or replace procedure FindBaseInfo(
v_id in out number,
v_name out varchar2,
v_title out varchar2
)is
temp integer(2);
begin
select count(*) into temp from employee where id=v_id;
if temp>0 then
select id,name,title into v_id,v_name,v_title from employee where id=v_id;
dbms_output.put_line('succeed!');
else
v_id:=0;
dbms_output.put_line('failed!');
end if;
end;调用过程如下:DECLARE
a number ;
b varchar2(10);
c varchar2(10);
begin
a:=&a;
FindBaseInfo(a,b,c);
end;这样写的话a输入1是可以运行的。但是为什么我改成FindBaseInfo(1,b,c)之后就报错了呢,难道plsql存储过程不允许在调用过程中直接赋值给参数吗?
create or replace procedure FindBaseInfo(
v_id in out number,
v_name out varchar2,
v_title out varchar2
)
因为上面的这个procedure中的参数v_id 是in out的,如果是in的话,你就可以直接FindBaseInfo(1,b,c)