• 0

[MySQL] Stored procedure won't INSERT?


Question

I am writing some CRUD procedures, and getting nowhere.  I used to develop in MySQL all the time, but moved to MS Sql and now I have forgotten more than I recall...

 

My table Colours has columns:

id - int autonumbering

label - varchar(50)

description - varchar(200)

reference - varchar(6)

 

All I'm trying to do is to put my INSERT procedure together - this should be childs play?

CREATE DEFINER=`niklouch`@`localhost` PROCEDURE `Colour_INSERT`(IN `@label` VARCHAR(50), IN `@description` VARCHAR(200), IN `@reference` VARCHAR(6))
    MODIFIES SQL DATA
INSERT INTO `Colour` (`id`, `label`, `description`, `reference`) VALUES (NULL, @label, @description, @reference)

When run, it certainly inserts a new row, with a new auto-numbered ID, but label, description and reference are all NULL

CALL Colour_INSERT('Red','Deep red akin to burgundy','FF0000')

Just inserts a blank row...

 

WTF?

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

Ah now here's a thing - without the  @ before the parameter it works.  No idea where I got that habbit from (certainly not something I would dream up) but hey!

Link to comment
Share on other sites

  • 0

Yeah well in C# if you use the mysql.net connector you specify parameters with the @ symbol. That's probably where you picked up the habit

 

That'll be it - swapping from language to language :)

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.