If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > STORED PROCEDURE problem!!!

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-19-11, 16:16
prestigious prestigious is offline
Registered User
 
Join Date: Sep 2011
Posts: 1
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)
Reply With Quote
  #2 (permalink)  
Old 09-19-11, 17:50
it-iss.com it-iss.com is offline
Registered User
 
Join Date: Sep 2009
Location: San Sebastian, Spain
Posts: 620
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
Senior Oracle/MySQL DBA
http://www.it-iss.com
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On