title: SQL Update statement with MEL expression - Mule
body: <p>I have a <code>SQL UPDATE</code> statement, to update a particular record to the Database within a mule flow. I am having problems with including MEL expression within the statement and the SQL is not getting executed in my flow.</p>
  
  <p>I am trying the next command:</p>
  
  <pre><code>UPDATE CUSTOMERS SET STATUS=#[flowVars['TxnStatus']] WHERE REF_NUM=#[flowVars['ReferenceNumber']]
  </code></pre>
  
  <p>where <code>TxnStatus</code> and <code>ReferenceNumber</code> are flow variables in my mule Flow. It looks seemingly simple, but the record is not updated.</p>
  
  <p>When I try a similar <code>SELECT</code> statement with MEL expressions it does retrieve the value for me. Please let me know your thoughts.</p>
  
  <p>Thanks,</p>
  
  <p>Added config file:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  
     &lt;jdbc-ee:mssql-data-source name="MuleDB_DataSource" user="${MuleDB_User}" password="${MuleDB_Password}" url="${MuleDB_URL}" transactionIsolation="UNSPECIFIED" doc:name="MS SQL Data Source"/&gt;
      &lt;jdbc-ee:connector name="Database" dataSource-ref="MuleDB_DataSource" validateConnections="true" queryTimeout="-1" pollingFrequency="10000" doc:name="Database" transactionPerMessage="false"&gt;
      &lt;/jdbc-ee:connector&gt;
      &lt;flow name="ExceptionFlowFlow1" doc:name="ExceptionFlowFlow1"&gt;
          &lt;vm:inbound-endpoint exchange-pattern="one-way" path="Exception" doc:name="VM"/&gt;
          &lt;set-variable variableName="ExceptionPayload" value="#[payload]" doc:name="ExceptionPayload"/&gt;
          &lt;set-variable variableName="TxnStatus" value="Failure" doc:name="Variable"/&gt;        
          &lt;logger message="#[variable:TxnStatus]" level="INFO" category="Status" doc:name="Logger"/&gt;
          &lt;jdbc-ee:outbound-endpoint exchange-pattern="one-way" queryKey="Update_Status" queryTimeout="-1" connector-ref="Database" doc:name="Update_Status"&gt;
              &lt;jdbc-ee:query key="Update_Status" value="UPDATE CUSTOMERS SET STATUS=#[flowVars['TxnStatus'] WHERE PAYMENT_REFERENCE_NUMBER=#[flowVars['TxnReference']"/&gt;
           &lt;/jdbc-ee:outbound-endpoint&gt;
          &lt;logger message="#[payload]" level="INFO" doc:name="Logger"/&gt;
          &lt;catch-exception-strategy doc:name="Catch Exception Strategy"&gt;
              &lt;logger message="#[exception]" level="INFO" category="ExceptionFlow failed with the exception --" doc:name="Logger"/&gt;
          &lt;/catch-exception-strategy&gt;
      &lt;/flow&gt;
  &lt;/mule&gt;
  </code></pre>