declare
  ls_dxm_n varchar2(10)
  your_counts number(5);
begin
  select count(dxm) into your_counts from jh_gs where gcbh='2';
  if your_counts!=0 then
     select dxm into ls_dxm_n from jh_gs where gcbh='2';
  else
     null;
  end if;
end;
/

解决方案 »

  1.   

    select into 语句必须得到一条记录(且只有一条记录),否则就触发异常。
    你可以使用游标,或者加上异常处理。
      

  2.   

    select into 语句本身就是一个隐式游标, 返回的时候必须是一条记录,
    如果返回为空或者有多条记录, 它都会产生异常:
        为空时返回:  no_data_found
        多记录时返回:too_many_rows
    所以你必须检查。
      

  3.   

    当没有记录时可以按 ATCG(ATCG) 的做法当多条记录时可以通过定义数组的方法解决具体例子星期一上班帮你解决