This article has participated in the call for good writing activities, click to view: back end, big front end double track submission, 20,000 yuan prize pool waiting for you to challenge!
Oracle stored procedure template
PROCEDURE proc_test(p_id IN NUMBER, v_cur OUT SYS_REFCURSOR, p_result_code OUT NUMBER, p_result_message OUT VARCHAR2) AS p_flag NUMBER; p_row frm_table1%ROWTYPE; BEGIN p_result_message := 'success '; p_result_code := '1'; BEGIN SELECT col_a INTO p_flag FROM frm_table2 WHERE id = p_id; EXCEPTION WHEN no_data_found THEN p_result_code := '0'; P_result_message := 'no data '; RETURN; END; FOR rs IN (SELECT col_b FROM frm_table3 WHERE id = p_id) LOOP dbms.output_putline("col_b" || col_b); END LOOP; OPEN v_cur FOR SELECT * FROM frm_table4; COMMIT; EXCEPTION WHEN OTHERS THEN ROLLBACK; p_result_code := '0'; P_result_message: = 'system exceptions:' | | SQLERRM; END;Copy the code