I wrote the following procedure but am having trouble setting the results of my stored procedures to the variables: @pZipID and @pCountyID. I have tried nesting the stored procedures in parentheses. That is to say:
SET @pCountyID = (CALL addCounty(pCounty));
I also tried:
CALL addCounty(pCounty) INTO @pCountyID
But to no avail. This is the entire stored procedure:
DROP PROCEDURE IF EXISTS readZipAndCountyIntoTables;
DELIMITER //
CREATE PROCEDURE getCountyNameFromZip(pZipcode VARCHAR(16), pCounty VARCHAR(250))
BEGIN
DECLARE pZipID INT DEFAULT 0;
DECLARE county_id INT DEFAULT 0;
SET @pZipID = CALL addZipcode(pZipcode);
SET @pCountyID = CALL addCounty(pCounty);
CALL addZipToCounty(pZipID, pCountyID);
END//
DELIMITER ;
MySql has been absolutely useless in finding the error. Please let me know if there is a small syntax issue I am causing as I know for a fact it is either the declaring or the setting that have issues. I took out the setting and declarations and called the stored procedures and no errors occured.
Let me know if you need to see the other stored procedures if you need more clarity. But they have been thoroughly tested.
Any help is appreciated. Thanks in advance.