MySQL Forums
Forum List  »  Stored Procedures

Re: Statement Only Erros in Procedure
Posted by: Peter Brawley
Date: March 22, 2016 05:48PM

Quote

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 ...

There must be no code before a DECLARE in a block. If you must execute that Select statement there, star a new BEGIN...END block before declaring the cursor.

BTW, UPDATE...LEFT JOIN... is unsound unless there is a solid reason to set c.carttypeid to null when the Left Join condition fails.

Nor is it clear to me why you can't accomplish what this sproc tries to do with straight SQL statements.

Options: ReplyQuote


Subject
Views
Written By
Posted
3054
March 22, 2016 03:37PM
Re: Statement Only Erros in Procedure
867
March 22, 2016 05:48PM


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.