title: Mysql: If a field in a record is empty I want the stored procedure to return N/A as value
body: <p>I have a table in <code>MySQL</code> where in a record a field (Default: None) does not have any value.</p>
  
  <p>I'm using a stored procedure to select values from this table and I when this field has no value I should get the value <code>N/A</code>.</p>
  
  <p>I tried the following code but I get the field with no value.</p>
  
  <pre><code>SELECT md.coding_id,
      md.patient_id,
      md.implant_date,
      (case 
          when md.device_and_implant_description = ''
              then 'N/A'
          when md.device_and_implant_description !=0
              then md.device_and_implant_description
       end) as device_and_implant_description
  FROM medical_devices_mapping as md
  WHERE md.patient_id = p_id
  </code></pre>
  
  <p>The <code>p_id</code> value is given by the user.</p>
  
  <p>This is the result:
  <a href="https://i.stack.imgur.com/zry2I.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/zry2I.png" alt="enter image description here"></a></p>
  
  <p>This is the structure of my table:</p>
  
  <p><a href="https://i.stack.imgur.com/sEn80.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/sEn80.png" alt="enter image description here"></a></p>