I have a stored procedure Insert, which I insert into 2 tables. The second table uses the Last_Insert_ID of the first table. Here is my sproc:
DELIMITER $$ CREATE DEFINER=`root`@`%` PROCEDURE `new_user_create`( IN oFarmName varchar(45), IN oFirstName varchar(45), IN oAddress1 varchar(45), IN oCity varchar(45), IN oState varchar(45), IN oZip varchar(45), IN oCountry varchar(45) ) BEGIN insert into intelliair.individual ( FarmName, FirstName) values ( oFarmName, oFirstName); insert into intelliair.address (IndividualID, Address1, City, State, Zip, Country) Values (Last_Insert_ID(), oAddress1, oCity, oState, oZip, oCountry); END
This is how I test the query in Workbench MySql:
call new_user_create(@myFarm, @MyName, @MyAddress, @MyCity, @MyState, @MyZip, @MyCountry)
There appears an error: "Column1 address cannot be null"
Where am I going? Is it in sproc? Or what do I call him?