1: plsql存儲過程當中將程序大量異常錯誤信息,以clob類型變量傳出sql
CREATE OR REPLACE PROCEDURE list_product_read(p_code IN OUT NOCOPY NUMBER, p_err_mesg IN OUT NOCOPY CLOB) AS ---------------------------------------------------------------------------------------- --商品目錄接口下發 --1.Date:20180724 --Author:xeeyung --Description: -- -------------------------------------------------------------------------------------------------------- v_log VARCHAR2(4000); v_strs VARCHAR2(32767); v_clob CLOB; BEGIN p_code := 0; dbms_lob.createtemporary(v_clob, TRUE); FOR v IN (SELECT t.id, t.ad_client_id, t.ad_org_id, t.ownerid, t.prod_id, t.name, t.basic_uom, t.orientation, t.status1, t.puc_mode, t.prod_year, t.prod_season, t.for_season, t.series, t.themedesign, t.prod_partm, t.prod_group, t.prod_sub_group, t.old_brand_id, t.brand_id, t.prod_sorts, t.prod_line FROM list_product t WHERE t.ediflag = 80) LOOP BEGIN --業務邏輯 --COMMIT; EXCEPTION WHEN OTHERS THEN --ROLLBACK; v_log := SQLERRM; p_code := 1; v_strs := '-款號[' || v.prod_id || ']:' || v_log; dbms_lob.append(v_clob, v_strs); END; END LOOP; p_err_mesg := v_clob; dbms_lob.freetemporary(v_clob); END;