programing

오류 1064(42000):SQL 구문에 오류가 있습니다. MariaDB 서버 버전에 해당하는 설명서를 확인하십시오.

goodsources 2023. 8. 4. 23:03
반응형

오류 1064(42000):SQL 구문에 오류가 있습니다. MariaDB 서버 버전에 해당하는 설명서를 확인하십시오.

ERROR 1064 (42000): 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 'select 1 from user_info where user_id = p_user_id))THEN select 'Username Exits !' at line 3



CREATE PROCEDURE `sp_create_user`(IN p_user_id varchar(20),IN p_user_pw varchar(20))
BEGIN
IF (select exits (select 1 from user_info where user_id = p_user_id))THEN select 'Username Exits !!';

첫 번째는 제거하는 것입니다.select()당신의IF조건, 두 번째 변경exits로.exists.

DELIMITER //
CREATE PROCEDURE sp_create_user( IN p_email varchar(80), IN p_username varchar(45), IN p_password varchar(45)) 
BEGIN 
    IF (exists (select 1 from user where username = p_username)) 
    THEN select 'Username Exists !!';
    ELSE 
        insert into user (email, username, password) values (p_email, p_username, p_password); 
    END IF; 
END //

DBFIDDLE 시도

언급URL : https://stackoverflow.com/questions/58333277/error-1064-42000-you-have-an-error-in-your-sql-syntax-check-the-manual-that

반응형