First off I apologize for being a newbie to MySQL but one must learn somewhere...
I am attempting to create a stored procedure that take input (primary key) and finds a field for that record and output to a variable...

my code so far:

CREATE PROCEDURE sp_dealer_name(
  IN dealerID CHAR,
  OUT dealername VARCHAR(45)
)
BEGIN
  SELECT DealName
  INTO dealername
  FROM dealer
  WHERE DealNum = dealerID;
END;

However I keep getting:
Error Number 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 9

I cant seem to figure out where I am going wrong
I am using MySQL Client Version 5.1.11 and
MySQL Server Version 5.1.41-community via TCP/IP

Any help would greatly be appreciated
Thank you

Ok it seems the Query Browser would not let me change the delimiter switch to command line changed delimiter to // and went through but now trying to :

CALL sp_dealer_name(B, @dealname);

Where B should place Escalation Creations into @dealname
but instead I receive:
Error 1054: Unknown column 'B' in 'field list'

OK syntax is a pain... I feel like an idiot but learning process can make you feel that way...

To solve the 1054 error all i was missing was a pair of ' '

instead of

CALL sp_dealer_name(B, @dealname);

I needed

CALL sp_dealer_name('B', @dealname);

Hope this helps someone in the future...

Be a part of the DaniWeb community

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