存储过程如下:
create or replace procedure tt(idid in integer,ritem in varchar2)
as temp varchar2(50):='没有数据';
begin
if ritem='' then
begin
select sname into temp from student where sid=idid;
end;
else
begin
temp:=ritem;
end;
end if;
insert into aa_test(studentid)
values(temp);
end;exec tt('123','');
前提:select sname from student where sid=‘123’;有一条数据
但是当ritem输入为空时,表aa_test里面是空的,为什么呢?
create or replace procedure tt(idid in integer,ritem in varchar2)
as temp varchar2(50):='没有数据';
begin
if ritem='' then
begin
select sname into temp from student where sid=idid;
end;
else
begin
temp:=ritem;
end;
end if;
insert into aa_test(studentid)
values(temp);
end;exec tt('123','');
前提:select sname from student where sid=‘123’;有一条数据
但是当ritem输入为空时,表aa_test里面是空的,为什么呢?
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货