Oracle select..into 变量。变量没有值!

abindede 2009-11-09 03:18:12
存储过程如下:
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里面是空的,为什么呢?
...全文
649 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
abindede 2009-11-09
  • 打赏
  • 举报
回复
3Q了!!!
小灰狼W 2009-11-09
  • 打赏
  • 举报
回复
if ritem is null then ...

17,377

社区成员

发帖
与我相关
我的任务
社区描述
Oracle 基础和管理
社区管理员
  • 基础和管理社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧