Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2011
    Posts
    1

    Unanswered: STORED PROCEDURE problem!!!

    DELIMITER $$

    DROP PROCEDURE IF EXISTS `Spesa`.`Insert`$$
    CREATE PROCEDURE `Spesa`.`Insert` (amount FLOAT,date DATE,subject INT,spendtype INT)
    BEGIN
    INSERT INTO Spese( ammonto,data )
    VALUES ( amount,date ) ;
    SET @N = LAST_INSERT_ID( ) ;
    INSERT INTO Rel_Spese_Soggetto( ID_Spesa, ID_soggetto )
    VALUES (@N , subject);
    INSERT INTO Rel_Spese_TipodiSpesa( ID_Spesa, ID_tipo_spesa )
    VALUES (@N , spendtype)
    END$$

    DELIMITER ;


    What's the problem???
    It gives the error: You have an error in your SQL syntax. (errno: 1064)

  2. #2
    Join Date
    Sep 2009
    Location
    San Sebastian, Spain
    Posts
    880
    Avoid using reserved words as variable names. date is a reserved word, also the procedure name called Insert I would suggest calling it add or something like that. I have created a table with all the reserved words in the various versions of MySQL http://www.google.com/url?sa=t&sourc...EW_irA&cad=rja
    Ronan Cashell
    Certified Oracle DBA/Certified MySQL Expert (DBA & Cluster DBA)
    http://www.it-iss.com
    Follow me on Twitter

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •