title: using a lookup table on a form with Oracle Apex Item
body: <p>I have an application that uses Oracle Apex 4.2 . It has a form ( form and report on a  table) that needs to display descriptions for columns on the table. For instance, there is a column on the table called fund which has a numeric value ( 1 to 6). There is a separate table that gives a description for each of these 6 values. Under EDIT PAGE ITEM, under SOURCE, I chose SOURCE TYPE -> SQL QUERY
  I entered this query below:</p>
  
  <pre><code>  SELECT DESCRIPTION FROM 
     "#OWNER#"."BU19ANT",
     "#OWNER#"."FUNDCD"
    WHERE ANTFUNDCD =  CODE
  </code></pre>
  
  <p>where BU19ANT is the table that used for this form
  FUNDCD is the name of the look up table
  ANTFUNDCD and CODE and numeric fields on the respective tables and DESCRIPTION is the value that I want to look up and display on the form. </p>
  
  <p>This gives me the correct answer MOST of the time, but not all the time.
  The key to the table ( and the field used to link from the report to the form) is the Soc Security Number. If I run this same query against the Oracle table hard coding the SS Number, I always get the correct answer.</p>
  
  <p>This form has 5 look ups that work this way and they all have the same problem.
  I assume that I DONT need to include the Social Security Number as part of the query  Apex already knows that.</p>
  
  <p>But I tried to add that and can not figure out how to code it.<br>
   I tried   </p>
  
  <pre><code>  WHERE ANTSOCIALSECURITYNUMBER ( column on table) = P2_SOCIALSECURITYNUMBER ( the item on this page)
  </code></pre>
  
  <p>but that gave this error </p>
  
  <blockquote>
    <p>ORA-00904: "P2_SOCIALSECURITYNUMBER ": invalid identifier</p>
  </blockquote>
  
  <p>Is there some other way to code this? Or to say where SS Number = current record?
  Or am I on the wrong track here?</p>