0 down vote favorite

I have a table:

    CREATE TABLE `student` (
      `id` int(11) NOT NULL AUTO_INCREMENT,
      `name` varchar(100) NOT NULL,
      `score` int(11) NOT NULL,
      PRIMARY KEY (`id`)

Now i want to create a stored procedure that will insert new column into this table with the next id (which is automaticly created), name (value which I will write), and score (which i will write).

Quoted Text Here

I have tryed

    DELIMITER ;;
    CREATE PROCEDURE insertStudent (IN name varchar(100),IN score int(11))
    BEGIN
        insert into student (name,score) values (newName,newScore);
    END
    ;;

But it doesnt seem to work.

I know this is basic but i need help.

Recommended Answers

DELIMITER ;;
CREATE PROCEDURE insertStudent (IN newName varchar(100), IN newScore int(11))
BEGIN
    INSERT INTO student (name, score) VALUES (newName, newScore);
END
;;

Your values should match your parameters.

Jump to Post

All 4 Replies

DELIMITER ;;
CREATE PROCEDURE insertStudent (IN newName varchar(100), IN newScore int(11))
BEGIN
    INSERT INTO student (name, score) VALUES (newName, newScore);
END
;;

Your values should match your parameters.

It doesnt seem to work agin.
Am I using the right CALL

call insertstudent(John Doe, 75)

Oh Thanks for updating.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.