title: PL/SQL Oracle Query With IF Statement
body: <p>I want to implement a query that only returns the logged in user and displays there record only, which I have done as follows and it works:</p>
  
  <pre><code>SELECT * FROM EMPLOYEE
  WHERE UPPER(username) = v('APP_USER')
  </code></pre>
  
  <p>However, I have another column called User_Type, and a user can be type 1, 2 or 3. If I have a user type of 1, I want the query to also return all the tables records too as user type 1 is an admin.</p>
  
  <p>I thought about doing it like this:</p>
  
  <pre><code>BEGIN
  SELECT * FROM Employee 
  WHERE upper(username) = v('APP_USER')
  IF User_Type = 1
  THEN SELECT * FROM Employee
  END IF;
  END;
  /
  </code></pre>
  
  <p>But it doesn't work in APEX Oracle PLSQL.</p>
  
  <p>Any suggestions? </p>