title: query inside the exception and begin block in exception
body: <p>Hello I want to ask what is the best practise to do.</p>
  <p>First example try to retrieve my data through exceptions I use this code in my main application and is working fine but I dont know if its good practise to code inside the exceptions blocks</p>
  <pre><code>BEGIN   
      DECLARE
          v_status varchar2(100);
          v_flag varchcar2(100);
      BEGIN 
          SELECT STATUS INTO v_status FROM TABLE1 WHERE condition1;
      EXCEPTION 
          when no_data_found then 
              select FLAG INTO v_flag FROM TABLE2   WHERE condition1; -- THERE WILL BE 100% RECORD 
              
              IF v_flag='N' THEN 
                  V_STATUS:='N'
              ELSIF v_flag:='O'
                  V_STATUS:='O'
              ELSE
                  BEGIN 
                      SELECT STATUS INTO V_STATUS FROM TABLE3 WHERE condition1,condition2;
                  EXCEPTION 
                      V_STATUS:='F';
                  END;
              END IF;         
      END;
  
      IF V_STATUS='O' THEN 
          --DO SOMETHING HERE 
      ELSIF V_STATUS='N' THEN 
          --DO SOMETHING HERE 
      ELSE 
          --DO SOMETHING HERE
      END IF;
  END;
  </code></pre>
  <p>SECOND EXAMPLE TRY TO RETRIEVE DATA WITH CASES AND SELECT WITH COUNT.</p>
  <pre><code>BEGIN   
      DECLARE 
          V_CNTR NUMBER;
          V_STATUS VARCHAR2(100);
      BEGIN 
          SELECT COUNT(1) INTO V_CNTR FROM TABLE1 WHERE condition1;
          CASE 
              WHEN COUNT=1 THEN 
                  SELECT STATUS INTO V_STATUS FROM TABLE1 WHERE condition1; 
              ELSE 
                  select FLAG INTO v_flag FROM TABLE2   WHERE condition1; -- THERE WILL BE 100% RECORD 
                  
                  IF v_flag='N' THEN 
                      V_STATUS:='N'
                  ELSIF v_flag:='O'
                      V_STATUS:='O'
                  ELSE 
                          SELECT COUNT(1) INTO V_CNTR FROM TABLE3 WHERE condition1,condition2;
                      CASE 
                          WHEN count=1 THEN 
                              SELECT STATUS INTO V_STATUS FROM TABLE3 WHERE condition1,condition2;
                          ELSE 
                              V_STATUS:='F';
                      END CASE; 
                  END IF;         
          END CASE;
      END;
  
      IF V_STATUS='O' THEN 
          --DO SOMETHING HERE 
      ELSIF V_STATUS='N' THEN 
          --DO SOMETHING HERE 
      ELSE 
          --DO SOMETHING HERE
      END IF;
  END;
  </code></pre>