oracle select into 的时候提示未找到数据

declare version varchar2(50);
begin
select version into version_id from 表a where 字段 = '1';

--在select into 后面添加exception 错误处理机制
exception
when no_data_found then
version:= 'hhh ';

--以上是处理select into 的时候提示未找到数据的处理方法
if version is null or version ='' then 
INSERT INTO 表a (字段) 
select NVL(max(VERSION),0)+1 from 表b ;
update 表3 set VERSION = (select NVL(max(VERSION),0) from 表a where 字段 = '1' )
where 字段 = '1';
commit;
end if;
end;
原文地址:https://www.cnblogs.com/zcwry/p/Oracle_select_into.html