반응형

SET @tmp1 = '12,13,14,15';

SET @xxx := CONCAT("SELECT * FROM t_user_master_card where user_seq = 1 and master_card_seq in (", @tmp1, ")");

SELECT @xxx;

PREPARE stmt FROM @xxx  ;

EXECUTE stmt   ;

DEALLOCATE PREPARE stmt ;



SET @tmp2 = 15;

SET @xxx := CONCAT("SELECT * FROM t_user_master_card where user_seq = 1 and master_card_seq in (?)");

SELECT @xxx;

PREPARE stmt FROM @xxx  ;

EXECUTE stmt USING @tmp2   ;

DEALLOCATE PREPARE stmt ;



반응형

'연구개발 > MYSQL' 카테고리의 다른 글

Couldn't find MySQL server  (0) 2015.11.12
형변환 에러시  (0) 2015.09.04
구분자 함수  (0) 2015.07.28
프로시저  (0) 2015.06.22
사용자 정의 변수  (0) 2015.06.16

+ Recent posts