MySQL Forums
Forum List  »  Stored Procedures

Re: insert doble last records- cursor/ insert
Posted by: Rick James
Date: July 16, 2014 05:18PM

Sorry, I do not know enough Spanish to even know what your question is.

That Stored Procedure can be greatly simplified by removing the cursor:

SELECT  DISTINCT nombre, 'EN'
    FROM  paises
    WHERE  NOT EXISTS 
      ( SELECT  *
            FROM  paises
            WHERE  id < paramId
      ); 
-- OR --
SELECT DISTINCT  nombre, 'EN'
    FROM  paises AS a
    LEFT JOIN  paises AS b USING (nombre)
    WHERE  b.nombre IS NULL; 

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: insert doble last records- cursor/ insert
1105
July 16, 2014 05:18PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.