Table of Contents
MySQL – DECLARE 에러
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
오류
아래 코드는 오류가 발생한다.
CREATE DEFINER=`root`@`%` PROCEDURE `usp_xxxxxxxx`()
BEGIN
set transaction isolation level read uncommitted;
DECLARE p_roomname varchar(50);
DECLARE 는 BEGIN 바로 다음에 있어야 한다.
CREATE DEFINER=`root`@`%` PROCEDURE `usp_xxxxxxxx`()
BEGIN
DECLARE p_roomname varchar(50);
set transaction isolation level read uncommitted;
원인
https://dev.mysql.com/doc/refman/5.7/en/declare.html
DECLARE is permitted only inside a BEGIN … END compound statement and must be at its start, before any other statements.
DECLARE 는 BEGIN … END 사이에 있어야 하고, 다른 어떤 문장보다도 상단에 위치해야 한다.
Declarations must follow a certain order. Cursor declarations must appear before handler declarations. Variable and condition declarations must appear before cursor or handler declarations.
DECLARE 내에서도 순서가 있다.
DECLARE 변수 and 조건
DECLARE 커서
DECLARE 핸들러
https://dev.mysql.com/doc/refman/5.7/en/declare.html
DECLARE is permitted only inside a BEGIN … END compound statement and must be at its start, before any other statements.