Stored Procedure

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Hieronimus

    #1

    Stored Procedure

    Hi all

    Can someone help me with the syntax to my stored procedure? Every time
    I try to run it I receive the error code 1064. I checked my syntax
    against the documentation on mysql.com and it seems to be correct, but
    of course I could be wrong. Here's my SP:

    delimiter |

    CREATE PROCEDURE `Universal`.`In sertCustomer`
    (IN _Name varchar, IN _Address varchar,
    IN _Username varchar, IN _Password varchar,
    IN _Email varchar, IN _Telephone int,
    IN _Newsletter tinyint, IN _PersonalData tinyint,
    IN _Profession varchar, IN _LanguageID int,
    IN _DateOfBirth date, IN _City varchar,
    IN _CountryID int, IN _FiscalNumber varchar)
    BEGIN

    INSERT INTO Customers ( Name, Address,
    PostalCode, Username,
    Password, Email,
    Telephone, Newsletter,
    PersonalData, Profession,
    LanguageID, CreationDate,
    DateOfBirth, City,
    CountryID, FiscalNumber)

    VALUES (_Name, _Address,
    _PostalCode, _Username,
    _Password, _Email,
    _Telephone, _Newsletter,
    _PersonalData, _Profession,
    _LanguageID, CURDATE(),
    _DateOfBirth, _City,
    _CountryID, _FiscalNumber)

    END|
    ;


    This is my error:
    Error Code : 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 ' IN
    _Address varchar,
    IN _Username varchar, IN _Password varchar,
    IN _Email ' at line 2
    (16 ms taken)

  • Bill Karwin

    #2
    Re: Stored Procedure

    Hieronimus wrote:[color=blue]
    > CREATE PROCEDURE `Universal`.`In sertCustomer`
    > (IN _Name varchar, IN _Address varchar,[/color]
    ....[color=blue]
    > Error Code : 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 ' IN
    > _Address varchar,
    > IN _Username varchar, IN _Password varchar,[/color]

    You have to specify a length with VARCHAR.
    For example, VARCHAR(30).

    Regards,
    Bill K.

    Comment

    Working...