title: MYSQL Procedures - INSERT INTO Return value
body: <p>I have the MYSQL stored procedure defined as shown below:</p>
  
  <pre><code>DROP PROCEDURE IF EXISTS TEST_LOCATION;
  
  CREATE PROCEDURE `TEST_LOCATION`()
     BEGIN
          DECLARE VCount tinyint(1) DEFAULT 1;
  
          INSERT INTO my_counts_model (type,code,model_code,count) 
          VALUES      ( 1,1,456,1) 
          ON DUPLICATE KEY UPDATE count = count + 1;     
   END;
  </code></pre>
  
  <p>The procedure updates the count if the <code>type,code,model_code</code> has the value in table, otherwise inserts a new record. I mean the key is on <code>type,code,model_code</code>.</p>
  
  <p>I want to get whether it is a new insert or the count update for further operations. I am trying to check for the return value of the <code>INSERT INTO</code>, but couldn't find syntax or any solution.</p>