MySQL Forums
Forum List  »  Stored Procedures

Store procedure Error 1064
Posted by: Fernando Genao
Date: August 17, 2018 11:54AM

This stored procedure doesn't work on the production server but on the developer.

Developer ver: mysql Ver 14.14 Distrib 5.7.23, for Linux (x86_64) using EditLine wrapper

Production Ver: mysql Ver 14.14 Distrib 5.7.23, for Linux (x86_64) using EditLine wrapper


CREATE DEFINER=`root`@`localhost` PROCEDURE `AgentTracking`()
BEGIN
SET @SQL = NULL;
SELECT
GROUP_CONCAT(DISTINCT
CONCAT(
'sum(case when programName = ''',
dt,
''' then 1 else 0 end) AS`',
dt, '`'
)
) INTO @SQL
FROM
(SELECT agentName, programName AS dt
FROM QA.vwTrack
GROUP BY agentName, programName
ORDER BY agentName) d;

SET @SQL= CONCAT('SELECT r.agentName, ', @SQL, '
FROM QA.vwTrack r

GROUP BY r.agentName');

PREPARE stmt FROM @SQL;
EXECUTE stmt;
END

Options: ReplyQuote


Subject
Views
Written By
Posted
Store procedure Error 1064
1123
August 17, 2018 11:54AM
500
August 17, 2018 01:10PM
570
August 17, 2018 01:26PM
516
August 29, 2018 09:24PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.