select * into t_row from table1 where a1='1';
exception
  when no_date_found then
...

解决方案 »

  1.   

    请问t_row 是ORACEL内置的变量吗
      

  2.   

    不是,是需要你在过程中定义
    declare
    t_row table1%rowtype;
    begin
    ....
      

  3.   

    这个问题好像问过。
    or:
    select count(*)
    into cnt 
    from table1 
    where a1='1';
    if cnt > 0  then
      ...
    end if;
      

  4.   

    如果单单从存在性检查上说,
    使用count(*)是效率很低的。
    试试rownum吧。我觉得这个问题使用异常是最好的。
      

  5.   

    to  jakarta
    我是问过,我就用的count(*),但是我总觉得不是很好!
    to  zhoubf725
    用rownum怎样实现呢!
      

  6.   

    select count(*)
    into cnt 
    from table1 
    where a1='1';
    if cnt > 0  then
      ...
    end if;
    上面这样写了,这样就行
      

  7.   

    select count(*) into cnt from table1 where a1='1' and rownum=1;
    if cnt>0 then
     ...
    end if;