Procedures MySql

-1

Hello, I'm new to procedures and I have a question I did not find on the internet.

I need to create a procedure to include 2 tables: "User", "Supplier".

The provider has a user FK, that is, in this procedure, I need to insert a user, get the id of that user and insert a provider with the Fk of the user that was created.

How can I do this?

Thank you in advance ...

    
asked by anonymous 20.10.2018 / 05:57

1 answer

0

After entering the user, use SELECT LAST_INSERT_ID(); to get the id of the created user, store the id in a variable, and then enter the provider.

    
20.10.2018 / 06:27