select into 语句,最好加上异常捕获

来源:互联网 发布:中小学网络教育 编辑:程序博客网 时间:2024/06/04 18:46
注意select into 语句,如果不是从dual中取值,那么最好加上异常捕获。如: BEGIN    select a.c_reportcode, c.c_unitid    into cnb_vvarB, cnb_nvarF    from tb_org_unitrelation a, TB_CNB_NDJXINFO b,tb_inf_employee c   where  b.c_empoid=c.c_oid     and a.c_orgunitid = c.c_unitid     and b.c_oid = to_number(cnb_vvarA);  EXCEPTIONWHEN NO_DATA_FOUND THEN  cnb_vvarB := 0;                  cnb_nvarF := 0;  END; 

原创粉丝点击