명령의 1 행에서 시작하는 중 오류 발생 -
DELIMITER $$
오류 보고 -
You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DELIMITER $$' at line 1
명령의 2 행에서 시작하는 중 오류 발생 -
CREATE OR REPLACE PROCEDURE tt.FN_CHEDULE
(IN _USERID VARCHAR(20), IN _USERNAME VARCHAR(20), IN _CENTER_NM VARCHAR(50), OUT RESULT INT)
BEGIN
DECLARE _CENTER_SEQ int(8) DEFAULT 0;
DECLARE _CNT int DEFAULT 0;
DECLARE i int DEFAULT 0;
DECLARE _LOG_DATE varchar(8);
/* 만약 SQL에러라면 ROLLBACK 처리한다. */
DECLARE exit handler for SQLEXCEPTION
BEGIN
ROLLBACK;
SET RESULT = -1;
END;
/* 트랜젝션 시작 */
START TRANSACTION;
/* 대상자 조회 쿼리 */
select
b.CENTER_SEQ,
b.USER_ID,
b.USER_NM,
b.USER_TYPE,
a.CENTER_NM
into _CENTER_SEQ
from center a left join (mgr b) on (a.CENTER_SEQ = b.CENTER_SEQ)
where b.USER_ID = _USERID
and b.USER_NM = _USERNAME
and a.CENTER_NM = _CENTER_NM;
/* 대상자 스케줄 조회 쿼리 */
select count(*) as cnt
into _CNT
from schedule
where USER_ID = _USERID
and CENTER_SEQ = _CENTER_SEQ
and ymd like '2018%';
IF _CNT > 0 then
SET RESULT = -2;
ROLLBACK;
ELSE
WHILE i <= 45 DO
SET _LOG_DATE = DATE_FORMAT(DATE_ADD(20180101, INTERVAL i DAY),'%Y%m%d');
select
_CENTER_SEQ as CENTER_SEQ,
_USERID as USER_ID,
_LOG_DATE AS YMD,
temp.ST_TIME,
temp.ED_TIME,
_USERID as REG_ID,
DATE_FORMAT(now(),'%Y%m%d%H%i%S') as REG_DT
from (
select '0900' AS ST_TIME, '1000' AS ED_TIME from dual
union all
select '1000' AS ST_TIME, '1100' AS ED_TIME from dual
union all
select '1100' AS ST_TIME, '1200' AS ED_TIME from dual
union all
select '1200' AS ST_TIME, '1300' AS ED_TIME from dual
union all
select '1300' AS ST_TIME, '1400' AS ED_TIME from dual
union all
select '1400' AS ST_TIME, '1500' AS ED_TIME from dual
union all
select '1500' AS ST_TIME, '1600' AS ED_TIME from dual
union all
select '1600' AS ST_TIME, '1700' AS ED_TIME from dual
union all
select '1700' AS ST_TIME, '1800' AS ED_TIME from dual
) temp;
SET i = i + 1;
END WHILE;
END IF;
COMMIT;
SET RESULT = 0;
END$$
DELIMITER ;
오류 보고 -
You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DELIMITER' at line 104
왜 오류인지를 모르겠는데.. 좀 알려주실분 안계신가요?
END; $$ 변경후 실행해도
명령의 1 행에서 시작하는 중 오류 발생 -
DELIMITER $$
오류 보고 -
You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DELIMITER $$' at line 1
명령의 2 행에서 시작하는 중 오류 발생 -
오류 보고 -
You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '$$
DELIMITER' at line 103
발생해요 ㅜㅜ