title: Using PL/SQL Function returning query to populate LOV
body: <p>I'm trying to populate a LOV using a PL/SQL Function returning a Query for the first time. I can't seem to get the syntax correct as I'm always receiving the following error on validation:</p>
  <blockquote>
  <p>ORA-20999: Parsing returned query results in &quot;ORA-20999: Failed to parse SQL query!</p>
  </blockquote>
  <blockquote>
  <p>ORA-06550: line 2, column 145: ORA-00923: FROM keyword not found where expected</p>
  </blockquote>
  <p>of the following PL/SQL Function:</p>
  <pre><code>DECLARE
  EMPLOYEES NUMBER := 0;
  QR varchar(4000);
  
  BEGIN
  
  SELECT COUNT(*) INTO EMPLOYEES FROM TS4_USER@TS_INFO_4.STT
  WHERE MAN_QT = :APP_USER
  
  IF EMPLOYEES = 0 THEN
  
  QR :=     'select FIRST_NAME|| '' '' ||LAST_NAME d, select FIRST_NAME|| '' '' 
      ||LAST_NAME r 
       FROM TS4_USER@TS_INFO_4.STT 
       WHERE MAN_QT IN (SELECT QT FROM TS4_USER@TS_INFO_4.STT
              WHERE MAN_QT = (SELECT MAN_QT FROM TS4_USER@TS_INFO_4.STT 
                        WHERE QT = :APP_USER)) AND FL = ''ESA''';
  
  ELSE
  
  QR :=     'select FIRST_NAME|| '' '' ||LAST_NAME d, select FIRST_NAME|| '' '' 
      ||LAST_NAME r 
      from TS4_USER@TS_INFO_4.STT 
      where MAN_QT = :APP_USER';
  END IF;
  
  RETURN QR;
  END
  </code></pre>
  <p>This is confusing as Line 2 is part of my declaration area and I wouldn't expect a FROM here.</p>