sale 테이블에서 고객 테이블을 업데이트, 인서트 트리거로 업데이트 할려구 합니다.
그런데 널값일때는 이미지를 업데이트 안하고자 하는데도
자꾸 업데이트가 되네요. ㅠㅠ''
구해주세효'
SELECT cst_id, stf_anm, sal_sati, sal_img as sal_img INTO cstid, staffanm, salsati, cstimage FROM ts_sale WHERE shp_id = NEW.shp_id AND sal_id = NEW.sal_id;
IF length(trim(cstimage)) = 0
THEN
UPDATE tu_cust SET cst_sati = salsati, stf_anm = staffanm, grd_nm = grade WHERE shp_id = NEW.shp_id AND cst_id = cstid;
ELSE
UPDATE tu_cust SET cst_sati = salsati, stf_anm = staffanm, grd_nm = grade, cst_image = cstimage WHERE shp_id = NEW.shp_id AND cst_id = cstid;
END IF;
|