List:General Discussion« Previous MessageNext Message »
From:NAYAN (NAYAN) DAREKAR Date:July 1 2010 7:49am
Subject:stored procedure syntax error
View as plain text  
Hi all !

I m getting an error while writing stored procedure, the code is as below and error

CODE

--------------------------------------------------------------------------------------------------
DELIMITER $$
DROP PROCEDURE IF EXISTS `aaa` $$
CREATE DEFINER=`root`@`%<mailto:DEFINER=`root`@`%>` PROCEDURE `aaa`()
BEGIN
DECLARE b VARCHAR(255);
DECLARE c VARCHAR(255);
SET b= CONCAT(SUBDATE(CURDATE(), INTERVAL 15 DAY)," 00:00:00");
SET c= CONCAT("'","C://cells_summary.csv","'");
SELECT * INTO OUTFILE (c) FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' LINES
TERMINATED BY '\n' FROM cells_summary WHERE PMMDATEANDTIME=b; //wrong
END $$
DELIMITER ;
------------------------------------------------------------------------------------------------------

ERROR
---------------------------------------------------------------------------------------------------------------------------
Script line: 4 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 '(c) FIELDS TERMINATED BY ','
OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\n'' at line 7
---------------------------------------------------------------------------------------------------------

I guess there is a wronge syntax,

SELECT * INTO OUTFILE (c) FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' LINES
TERMINATED BY '\n' FROM cells_summary WHERE PMMDATEANDTIME=b;



kindly anyone can help with correct syntax.....



Thanx


Thread
stored procedure syntax errorNAYAN)1 Jul
  • Re: stored procedure syntax errorNilnandan Joshi1 Jul