Delimiter En Mysql Error #1064
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company mysql error 1064 42000 Business Learn more about hiring developers or posting ads with us Stack Overflow Questions mysql error 1064 insert Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, mysql error 1064 create table just like you, helping each other. Join them; it only takes a minute: Sign up MySQL Syntax Error on DELIMITER before CREATE TRIGGER up vote 1 down vote favorite 1 I'm trying to rewrite a Trigger mysql error 1064 create user that I made with Firebird to a MySql Trigger. I realy have no idea what could be. If anyone could help me... thanks I'm submiting the SQL with PHP just like follows, and the error message is: Invalid query: 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 'DELIMITER $$ CREATE TRIGGER FP_PAGO_AI AFTER INSERT ON FORMA_PGTO FOR
Mysql Error 1064 Sqlstate 42000
EACH R' at line 1 The trigger's code is: $str[] = " DELIMITER $$ CREATE TRIGGER FP_PAGO_AU AFTER UPDATE ON FORMA_PGTO FOR EACH ROW BEGIN declare rec_count integer; declare pg_count integer; declare cp_pago integer; select count(*) from forma_pgto fp where fp.id_cpagar=new.id_cpagar into rec_count; select count(pago) from forma_pgto f where f.id_cpagar=new.id_cpagar and f.pago=1 into pg_count; /* Se todas parcelas estao pagas, entao setar conta paga */ if (rec_count = pg_count) then update cpagar c set c.pago=1 where c.id=new.id_cpagar; /* Senao */ else /* Se CPAGAR.PAGO = 1, recebe 0 */ select cpg.pago from cpagar cpg where cpg.id=new.id_cpagar into cp_pago; if (cp_pago = 1) then /* Se cp_pago = 1 */ update cpagar set pago=0 where id=new.id_cpagar; end if; end if; END END $$ DELIMITER ; "; mysql triggers share|improve this question edited Nov 4 '13 at 18:30 Bill Karwin 282k50392567 asked Nov 4 '13 at 16:37 trebew 3017 The method you use to send this to MySQL can only execute 1 statement at a time. DELIMITER $$ is one statement. –juergen d Nov 4 '13 at 16:39 You mean the PHP mysql_query function? Well, anyway, I tried to submit the query directly in phpMyAdmin and it returned other error: #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MyS
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn
Mysql Error Code 1064
more about Stack Overflow the company Business Learn more about hiring developers or mysql error 1064 create trigger posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community mysql error 1064 create database Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up mysql: DELIMITER syntax error at line 1 up vote 5 http://stackoverflow.com/questions/19772458/mysql-syntax-error-on-delimiter-before-create-trigger down vote favorite 1 I try to add this function using the following SQL in phpmyadmin/MySQL DROP FUNCTION IF EXISTS `__myv`; DELIMITER ;; CREATE FUNCTION `__myv`(`a` int, `b` int) RETURNS bigint(20) BEGIN return FLOOR(a / b); END;; DELIMITER ; but I get this error: Error SQL query: DELIMITER; MySQL said: Documentation #1064 - You have an error in your SQL syntax; check the manual that corresponds to your http://stackoverflow.com/questions/20313481/mysql-delimiter-syntax-error-at-line-1 MySQL server version for the right syntax to use near 'DELIMITER' at line 1 How to fix this error?? mysql phpmyadmin share|improve this question edited Dec 1 '13 at 15:10 a_horse_with_no_name 184k24231308 asked Dec 1 '13 at 14:57 Alex.DX 581313 add a comment| 2 Answers 2 active oldest votes up vote 1 down vote accepted Even if DELIMITER is a console command, phpMyAdmin's import module has accepted it since many years. When opening a database and clicking on SQL, a query entered there is passed to the import module, so it should work (unless you have a very old phpMyAdmin version). share|improve this answer answered Dec 1 '13 at 18:49 Marc Delisle 6,56131724 add a comment| Did you find this question interesting? Try our newsletter Sign up for our newsletter and get our top new questions delivered to your inbox (see an example). Subscribed! Success! Please click the link in the confirmation email to activate your subscription. up vote 5 down vote DELIMITER is a Mysql console command, You can't use it in phpmyadmin. To set the delimiter in phpmyadmin, see this other answer share|improve this answer answered Dec 1 '13 at 15:05 Filipe Silva 15.8k32446 But in xampp(local) se
log in tour help Tour Start here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the http://dba.stackexchange.com/questions/88968/delimiter-issue-in-mysql-5-6 company Business Learn more about hiring developers or posting ads with us Database Administrators Questions Tags Users Badges Unanswered Ask Question _ Database Administrators Stack Exchange is a question and answer site for database professionals who wish https://www.sitepoint.com/community/t/stored-procedure-1064-you-have-an-error-in-your-sql-syntax/6525 to improve their database skills and learn from others in the community. Join them; it only takes a minute: Sign up Here's how it works: Anybody can ask a question Anybody can answer The best answers are mysql error voted up and rise to the top DELIMITER issue in MySQL 5.6 up vote 1 down vote favorite Drop procedure if EXISTS rotatepjp; DELIMITER // CREATE PROCEDURE rotatepjp() BEGIN DECLARE u_id, settingval, pjp_userid, pjp_beatid, u_frequency INT; DECLARE u_pjpstartdate, pjp_fordate, tilldate, newdate DATE; SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED ; SELECT value INTO settingval FROM settings where name = 'autorotatepjp'; IF settingval > 0 THEN BEGIN DECLARE done INT DEFAULT FALSE; DECLARE cur1 CURSOR FOR mysql error 1064 SELECT id, pjpstartdate, frequency FROM users; DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; #open cursor OPEN cur1; #starts the loop the_loop: LOOP #get the values of each column into our variables FETCH cur1 INTO u_id, u_pjpstartdate, u_frequency; IF done THEN LEAVE the_loop; END IF; #Do some post processing IF u_frequency > 0 THEN SET tilldate = DATE_ADD( u_pjpstartdate, INTERVAL u_frequency DAY ); IF tilldate = CURDATE() THEN BEGIN DECLARE done1 INT DEFAULT FALSE; DECLARE cur2 CURSOR FOR SELECT user_id, beat_id, fordate FROM pjps where user_id = u_id and fordate >= u_pjpstartdate and fordate < tilldate; DECLARE CONTINUE HANDLER FOR NOT FOUND SET done1 = TRUE; OPEN cur2; the_loop1: LOOP #get the values of each column into our variables FETCH cur2 INTO pjp_userid, pjp_beatid, pjp_fordate; IF done1 THEN LEAVE the_loop1; END IF; SET newdate = DATE_ADD( pjp_fordate, INTERVAL u_frequency DAY ); INSERT INTO pjps (user_id, beat_id, fordate, created, modified ) VALUES ( pjp_userid, pjp_beatid, newdate, NOW(), NOW() ); END LOOP the_loop1; UPDATE users set pjpstartdate = CURDATE(), modified = NOW() where id = u_id; END; END IF; END IF; END LOOP the_loop; END; END IF; COMMIT ; END // DELIMITER ; this code is working in innodb_version 5.5.34 but not working innodb_version 5.6.21.......any clue, where I am doing mistake??? error - #1064 - You have an error in yo
server using phpMyadmin, It generates an error. Here is the message generate in phpMyadmin . ErrorSQL query: CREATE PROCEDURE writermgt.approvalProcess ( IN articleId INT,IN managerId INT) BEGIN DECLARE amount FLOAT; MySQL said: 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 4 The server wants to say may be error in declare statement. But what's the error?Here is my code DROP PROCEDURE IF EXISTS writermgt.approvalProcess; CREATE PROCEDURE writermgt.`approvalProcess`(IN articleId INT, IN managerId INT) BEGIN DECLARE amount FLOAT; DECLARE totalcost FLOAT; DECLARE multiplier FLOAT; DECLARE writerId INT; START TRANSACTION; UPDATE art_r_manager SET status = 'A' WHERE artid = articleId; UPDATE art_r_writer SET status = 'A' WHERE artid = articleId; SELECT cost INTO amount FROM article WHERE artid = articleId; SELECT cost_multiplier INTO multiplier FROM acmanager WHERE pid = managerId; SELECT (amount + (multiplier * amount)) INTO totalcost; SELECT wid INTO writerId FROM art_r_writer WHERE artid = articleId; INSERT INTO baccount_writer VALUES ('', writerId, articleId, amount, '0'); INSERT INTO baccount_manager VALUES ('', managerId, articleId, totalcost, '0'); COMMIT; END; Thanks in advanced. r937 2010-09-03 04:17:46 UTC #2 you need to set a delimiter see http://dev.mysql.com/doc/refman/5.1/en/stored-programs-defining.html rashidul 2010-09-06 01:29:22 UTC #3 Hi, Vary much thanks for ur comment. Again I got ERROR! ErrorThere seems to be an error in your SQL query. The MySQL server error output below, if there is any, may also help you in diagnosing the problem ERROR: Unknown Punctuation String @ 11STR: //SQL: delimiter //CREATE PROCEDURE actionsAddingToArticleQueue(IN articleId INT,IN workerId INT,OUT success INT)BEGIN DECLARE existWriter INT; SQL query: delimiter // CREATE PROCE