Statement Only Erros in Procedure
I have an update statement that works when run, on it's own, in a query window but is generating a syntax error (missing 'end' in the context of a stored procedure.
This is the statement in question:
UPDATE t_Card c LEFT JOIN t_CardType ct ON c.CardTypeId = ct.CardTypeId SET c.CardType = ct.CardType;
If I remove it from the procedure, no problem, if I run it on it's own, no problem.
Here is the whole code block:
CREATE DEFINER=`myaccount`@`%` PROCEDURE `spUpdateCardType`()
BEGIN
DECLARE cardid char(36);
DECLARE cardsubtype nvarchar(128);
UPDATE t_Card c LEFT JOIN t_CardType ct ON c.CardTypeId = ct.CardTypeId SET c.CardType = ct.CardType;
# Add subtypes
DECLARE updateCur CURSOR FOR
SELECT cxcst.CardId, cst.CardSubType
FROM t_CardXCardSubType cxcst
INNER JOIN t_CardSubType cst ON cxcst.CardSubTypeId = cst.CardSubTypeId
ORDER BY cxcst.CardId, cxcst.xSequence;
OPEN updateCur;
update_loop: LOOP
FETCH updateCur INTO cardid, cardsubtype;
UPDATE t_Card c SET c.CardType = CONCAT(c.CardType, " - ", cardsubtype) WHERE c.CardId = cardid;
END LOOP update_loop;
CLOSE updateCur;
END
Subject
Views
Written By
Posted
Statement Only Erros in Procedure
3053
March 22, 2016 03:37PM
866
March 22, 2016 05:48PM
902
March 23, 2016 07:17AM
831
April 01, 2016 10:44AM
743
April 12, 2016 07:45PM
858
April 13, 2016 08:37AM
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.