posted by 권오성의 Biomedical Engineering 2009. 10. 5. 11:38

프로시져 또는 트리거 실행 시 SELECT INTO에서 조회된 쿼리의 ROW가 존재하지 않을때

ORA-01403 에러발생 조치

1. Select  절에서 Row가 없는 경우 Exception으로 뺀다.

예)

  select rtptno
    into v_rtptno
    from mosstbat
   where pt_no = :new.q_patientno;

결과가 no_data_found로 나온 경우

아래와 같이 exception을 추가해 준다.

 begin

  select rtptno
    into v_rtptno
    from mosstbat
   where pt_no = :new.Q_PATIENTNO;

  exception
   when no_data_found then null;
   when others then
    null;

 end;