Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
Tags
- spring security
- 관계형 데이터베이스
- 자바스크립트
- UUID
- 자바 ORM 표준 JPA 프로그래밍
- ORM
- 유효성검사
- msa
- 자바
- Thymeleaf
- JPA
- 중복되지 않는 값 만들기
- 스프링 시큐리티
- 공백검사
- 출처 모던 자바스크립트 Deep Dive
- 게시판 작성자를 아이디로
- java
- 모던 자바스크립트 Deep Dive
Archives
- Today
- Total
인지용
Mysql 프로시저 만들때 to your MySQL server version for the right syntax to use near 에러 본문
에러 해결
Mysql 프로시저 만들때 to your MySQL server version for the right syntax to use near 에러
인지용 2021. 11. 10. 21:06대량의 데이터를 테이블에 저장하기 위해서
프로시저를 만드는데
select * from board;
위 코드처럼 ;(세미콜론)이 들어가는 구문에서
to your MySQL server version for the right syntax to use near 에러가 뜨길래 알아보니
구분 기호의 문제였다.
쿼리 끝낼 때 쓰는 세미콜론이 중간에 들어가서 그런 것이다.
해결방법
일단 구분 기호 ;(세미콜론)을 다른 기호로 바꿔주면 된다.
DELIMITER //
그 후 프로시저를 만들고 나선 다시 되돌려주면 된다.
DELIMITER ;
예시)
DELIMITER //
CREATE PROCEDURE select()
BEGIN
SELECT * FROM board;
END;
//
DELIMITER ;
프로시저 호출
CALL select();
프로시저 안에 select * from board; 말고
다른 쿼리를 넣어도 된다.
insert loop 프로시저 예시)
Drop procedure if exists test;
DELIMITER //
create procedure `test`()
BEGIN
DECLARE i INT DEFAULT 1;
WHILE ( i <= 500 ) DO
INSERT INTO member (username, password, createdDate)
values ('name', 'password', now());
SET i = i+1;
END WHILE;
END;
//
DELIMITER ;
출처
How to resolve the MySQL error “You have an error in your SQL syntax; check the manual that corresponds to your MySQL server v
How to resolve the MySQL error “You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near?” To avoid this type of error in MySQL stored procedure, you need to change the delimi
www.tutorialspoint.com