首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > 其他数据库 >

oracle select into 未找到数据的处置办法

2012-07-27 
oracle select into 未找到数据的处理办法1createorreplaceprocedurep_test2as3v_GVARCHAR2(10)4begin5be

oracle select into 未找到数据的处理办法
    1     create   or   replace   procedure   p_test
    2     as
    3     v_G   VARCHAR2(10);
    4     begin
    5     begin
    6     select   name   into   v_G   from   test   where   id   =1;
    7     exception
    8     when   no_data_found   then
    9     v_G:= 'hhh ';
  10     end;
  11     dbms_output.put_line(v_G);
  12*   END;
SQL>   /

过程已创建。

SQL>   exec   p_test

PL/SQL   过程已成功完成。

SQL>   set   serveroutput   on
SQL>   exec   p_test;
hhh

PL/SQL   过程已成功完成。

热点排行