SQL/MySql

Mysql 에러 execute command denied to user ~ for routine

daeyun대윤 2023. 2. 20. 20:04

mysql 쿼리 중.. case 문 작성하고 있었는데 에러남...

execute command denied to user ~ for routine

 

원인은 콤마를 빼먹은 것이었음!!!

case앞에 괄호... 콤마를 빼먹었고... 지금은 다시 잘 적어줌.

콤마 안빼먹으려고 앞에다가 위치 시킨건데도 빼먹다니..!!!!

SELECT 
 a.TRMNL_ID2
,a.TRMNL_ERR
,a.PM2_5
,a.PM10
,(CASE a.PM10
  WHEN a.PM10 < 30  THEN '좋음'
  WHEN a.PM10 < 80  THEN '보통'
  WHEN a.PM10 < 150 THEN '나쁨'
  ELSE '매우나쁨'
  END) AS PM10_str
,a.TMPR_VAL
,a.HMDT_VAL
,a.OCRN_DT
,a.SCN_ID 
FROM l_dust_clct AS a
LEFT JOIN m_dust_trmnl_inf AS b
ON a.TRMNL_ID2 = b.TRMNL_ID
WHERE  
    a.OCRN_DT >= DATE_FORMAT('2023-02-20 09:00:00','%Y-%m-%d %H:%i:%s')
AND a.OCRN_DT < DATE_ADD(	DATE_FORMAT('2023-02-20 09:02:00','%Y-%m-%d %H:%i:%s'), INTERVAL 1 DAY)
AND a.SCN_ID = 'S000000062';
728x90
300x250