I want to write a MySQL proc which takes userId and userName and does an insert or update into table users dependent on if a row exists where users.userId = userId
I saw a similar question here: MySql create or update row with ip?
But I want to do this in a stored procedure and wondered if that gives any additional tools?
You don’t need a stored procedure, you can use
INSERT ... ON DUPLICATE KEY UPDATE .... Assuming that userid is thePRIMARYor aUNIQUEkey, this will work:Of course, you could wrap this query in a stored procedure if you want: