title: UPSERT Query gives ORA Missing Expression Exception
body: <p>I am trying to update and insert into Oracle Database by using this below query. But when I was trying to insert into oracle database by using this below query, I always get the exception as-</p>
  
  <pre><code>java.sql.SQLException: ORA-00936: missing expression
  </code></pre>
  
  <p>This is the below UPSERT Query- Is there anything wrong with this below query?</p>
  
  <pre><code>// Update and Insert both
      public static final String UPSERT_SQL = "MERGE INTO " +DATABASE_TABLE+ " USING (  SELECT ? AS ID, " +    // We will maybe add this record
      "                ? AS CGUID, " +
      "                ? AS PGUID, " +
      "                ? AS SGUID, "+
      "                ? AS USERID, "+
      "                ? AS ULOC, "+
      "                ? AS SLOC, "+
      "                ? AS PLOC, "+
      "                ? AS ALOC, "+
      "                ? AS SITEID, "+
      "                FROM dual ) maybe "+
      // Checking whether ID got matched, if matched then we will update the database table (ULOC, SLOC, PLOC, ALOC)
      "   ON (maybe.ID = "+DATABASE_TABLE+".ID) "+
      "         WHEN MATCHED THEN "+
              // We only need update the fields that might have changed
      "       UPDATE SET " +DATABASE_TABLE+ ".ULOC = maybe.ULOC, " +DATABASE_TABLE+ ".SLOC = maybe.SLOC, " +DATABASE_TABLE+ ".PLOC = maybe.PLOC, " +DATABASE_TABLE+ ".ALOC = maybe.ALOC "+
      // If not matched then we will Insert new records in the database.
      "         WHEN NOT MATCHED THEN "+
         // Insert new record
      "   INSERT VALUES (maybe.ID, maybe.CGUID, maybe.PGUID, maybe.SGUID, maybe.USERID, maybe.ULOC, maybe.SLOC, maybe.PLOC, maybe.ALOC, maybe.SITEID)";
  </code></pre>
  
  <p>And I am trying to insert like this-</p>
  
  <pre><code>LnPDataConstants.PSTMT = LnPDataConstants.DB_CONNECTION.prepareStatement(LnPDataConstants.UPSERT_SQL);
  LnPDataConstants.PSTMT.setInt(1, (int) ind);
  LnPDataConstants.PSTMT.setString(2, LnPDataConstants.CGUID_VALUE);
  LnPDataConstants.PSTMT.setString(3, LnPDataConstants.PGUID_VALUE);
  LnPDataConstants.PSTMT.setString(4, LnPDataConstants.SGUID_VALUE);
  LnPDataConstants.PSTMT.setString(5, LnPDataConstants.UID_VALUE);
  LnPDataConstants.PSTMT.setString(6, LnPDataConstants.ULOC_VALUE);
  LnPDataConstants.PSTMT.setString(7, LnPDataConstants.SLOC_VALUE);
  LnPDataConstants.PSTMT.setString(8, LnPDataConstants.PLOC_VALUE);
  LnPDataConstants.PSTMT.setString(9, LnPDataConstants.ALOC_VALUE);
  LnPDataConstants.PSTMT.setString(10, LnPDataConstants.SITEID_VALUE);
  LnPDataConstants.PSTMT.executeUpdate();
  </code></pre>
  
  <p>And when I tried to print the query- I got like this on the console-</p>
  
  <pre><code>MERGE INTO LNPDATA USING (  SELECT ? AS ID,                 ? AS CGUID,                 ? AS PGUID,                 ? AS SGUID,                 ? AS USERID,                 ? AS ULOC,                 ? AS SLOC,                 ? AS PLOC,                 ? AS ALOC,                 ? AS SITEID,                 FROM dual ) maybe    ON (maybe.ID = LNPDATA.ID)          WHEN MATCHED THEN        UPDATE SET LNPDATA.ULOC = maybe.ULOC, LNPDATA.SLOC = maybe.SLOC, LNPDATA.PLOC = maybe.PLOC, LNPDATA.ALOC = maybe.ALOC          WHEN NOT MATCHED THEN    INSERT VALUES (maybe.ID, maybe.CGUID, maybe.PGUID, maybe.SGUID, maybe.USERID, maybe.ULOC, maybe.SLOC, maybe.PLOC, maybe.ALOC, maybe.SITEID)
  </code></pre>