MySQL Forums
Forum List  »  Stored Procedures

Problem with creating a stored procedure
Posted by: Mike Markgraf
Date: April 13, 2012 03:08PM

I used the workbench to create a routine, but now when I run it in phpmyadmin with MySQl 5.5 it keeps giving me an error. Can someone point out what I am doing wrong, this is my first time doing procedures with MySQL. Code below


SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL';

CREATE SCHEMA IF NOT EXISTS `testfinal1` DEFAULT CHARACTER SET latin1 ;
USE `testfinal1` ;

-- -----------------------------------------------------
-- procedure sp_addChild
-- -----------------------------------------------------

DELIMITER $$
USE `testfinal1`$$
CREATE PROCEDURE `testfinal1`.`sp_addChild`
(
CID int,
fname varchar(50),
lname varchar(50),
DOB DATETIME,
gender varchar(10),
goals varchar(255),
nameMeaning varchar(255),
orphaned tinyint,
family varchar(255),
eligible tinyint,
notes varchar(255)
-- May need foreign key constraint
)
BEGIN

Insert into Children
(
Child_ID,
Child_Fname,
Child_lname,
Child_DOB,
Child_gender,
Child_goals,
Child_nameMeaning,
Child_orphaned,
Child_family,
Child_eligible,
Child_notes
)
values
(
CID,
fname,
lname,
DOB,
gender,
goals,
nameMeaning,
orphaned,
family,
eligible,
notes
);
END
$$

DELIMITER ;


SET SQL_MODE=@OLD_SQL_MODE;
SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;

Options: ReplyQuote




Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.