PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Wednesday, December 29, 2021

[FIXED] ERROR: SET FOREIGN_KEY_CHECKS = ON and #2014 - Commands out of sync; you can't run this command now

 December 29, 2021     mysql, phpmyadmin, sql     No comments   

Issue

in PHPMYADMIN i want to call function that was in stored procedure and so i run a query this is one , CALL funcpara ('karthick');

FUNCTION CODE:

CREATE PROCEDURE `funcpara`(IN `uname` VARCHAR(255)) 
SELECT ct.CUST_NM, UPPER(CUST_NM) AS UppercaseCustomerName 
FROM customers ct
WHERE ct.CUST_NM = uname; 

i was enter a input value for parameter as above query, there was an error shows that was-

Error

Static analysis:

1 errors were found during analysis.

Missing expression. (near "ON" at position 25) SQL query: Edit Edit

SET FOREIGN_KEY_CHECKS = ON;

MySQL said:Documentation

#2014 - Commands out of sync; you can't run this command now

give me a solution if any knows, thanks for advance


Solution

You are missing BEGIN and END and the DELIMITER part.

Try:

DELIMITER //
CREATE PROCEDURE funcpara(uname VARCHAR(255)) 
BEGIN
SELECT CUST_NM, UPPER(CUST_NM) AS UppercaseCustomerName 
FROM customers ct
WHERE CUST_NM = uname; 
END//
DELIMITER ;

enter image description here



Answered By - Ergest Basha
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing