test a stored procedure in MySql Workbench

Viewed 60906

I have an Insert stored procedure where I am inserting into 2 tables. The second table using 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

Here is how I am testing the query in MySql workbench:

call new_user_create(@myFarm, @MyName, @MyAddress, @MyCity, @MyState, @MyZip, @MyCountry)

There error I get is: "Column Address1 cannot be null"

Where am I going wronng? Is it in the sproc? Or the way I am calling it?

3 Answers
Related