title: dynamic sql query error due to invalid character
body: <p>I have created a dynamic  query  inside a package like :</p>
  
  <pre><code> QUERY_STR := 'SELECT DISTINCT :1 
               FROM schema_name.'||  P_TABLE_NAME||' where UPPER(:2) NOT  IN (SELECT UPPER(LOOKUP_STG.LOOKUP_CODE)
  from XX_LOOKUP_EXT LOOKUP_STG where UPPER(:3)=upper(LOOKUP_CODE)
  and LOOKUP_STG.LOOKUP_TYPE=''' || P_LOOKUP_TYPE || ''') ;';
  </code></pre>
  
  <p>which i am trying to execute by </p>
  
  <pre><code>declare
  
      P_TABLE_NAME  varchar2(100):='XXHR_STG';
      P_LOOKUP_TYPE varchar2(100):='PER_SUPERVISOR_TYPE';
      p_column      VARCHAR2(100):='manager_type';
  
  begin
  XX_LOOKUP_VALIDATION.XX_VALIDATION_LOOKUP(P_TABLE_NAME,P_LOOKUP_TYPE,p_column);
  
  
  end;
  </code></pre>
  
  <p>Actually in the query_str the p_lookup_type should be in quotes something like :</p>
  
  <pre><code>SELECT DISTINCT  manager_type 
  FROM schema_name.XXHR_STG
   where UPPER(MANAGER_TYPE) NOT IN 
  (SELECT UPPER(LOOKUP_STG.LOOKUP_CODE)
  from XX_LOOKUP_EXT LOOKUP_STG where UPPER(MANAGER_TYPE)=upper(LOOKUP_CODE)
  and LOOKUP_STG.LOOKUP_TYPE='PER_SUPERVISOR_TYPE';
  </code></pre>
  
  <p>But on calling the package i am getting an invalid character error</p>
  
  <pre><code>00911. 00000 -  "invalid character"
  *Cause:    identifiers may not start with any ASCII character other than
             letters and numbers.  $#_ are also allowed after the first
             character.  Identifiers enclosed by doublequotes may contain
             any character other than a doublequote.  Alternative quotes
             (q'#...#') cannot use spaces, tabs, or carriage returns as
             delimiters.  For all other contexts, consult the SQL Language
             Reference Manual.
  *Action:
  </code></pre>
  
  <p>dbms output :</p>
  
  <pre><code>SELECT DISTINCT  :1 
  FROM schema_name.XXHR_STG
   where UPPER(:2) NOT IN 
  (select UPPER(LOOKUP_STG.LOOKUP_CODE)
  from XX_LOOKUP_EXT LOOKUP_STG where UPPER(:3)=UPPER(LOOKUP_CODE)
  and LOOKUP_STG.LOOKUP_TYPE='PER_SUPERVISOR_TYPE';
  </code></pre>