0

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

1
Contributor
2
Replies
4
Views
8 Years
Discussion Span
Last Post by Dmennite
0

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'

0

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...

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.