PL/SQL block problem: No data found error

后端 未结 5 1998
眼角桃花
眼角桃花 2020-12-02 14:29
SET SERVEROUTPUT ON
DECLARE
    v_student_id NUMBER := &sv_student_id;
    v_section_id NUMBER := 89;
    v_final_grade NUMBER;
    v_letter_grade CHAR(1);
BEGIN         


        
5条回答
  •  旧时难觅i
    2020-12-02 14:36

    There is an alternative approach I used when I couldn't rely on the EXCEPTION block at the bottom of my procedure. I had variables declared at the beginning:

    my_value VARCHAR := 'default';
    number_rows NUMBER := 0;
    .
    .
    .
    SELECT count(*) FROM TABLE INTO number_rows (etc.)
    
    IF number_rows > 0 -- Then obtain my_value with a query or constant, etc.
    END IF;
    

提交回复
热议问题