안녕하세요 업무에 SQL이 필요하여 기존 문구를 수정해서 사용중인데, 오류가 발생하여 문의드립니다.
SELECT CASE
WHEN HOUR(rsw.createdat) >= 18 THEN CAST(rsw.createdat AS date)
WHEN HOUR(rsw.createdat) <7 THEN CAST(rsw.createdat -INTERVAL '1' DAY AS date)
ELSE CAST(rsw.createdat AS date) END "입고일", CASE
WHEN HOUR(rsw.createdat) >= 18
OR HOUR(rsw.createdat) <7 THEN 'Swing'
ELSE 'DAY' END "SHIFT", rsw.updatedat "입고 시간", REPLACE(
rs.floor, 'F_', ''
) "근무 층", lot.fullname "토트번호", rsw.skuid "SKU ID", sku.barcode "상품 바코드", sku.name "상품명", sku.manufacturername "제조업체", CASE
sku.agent WHEN 'WAKLE' THEN '상품'
ELSE 'AAA'
END AS "매입 구분", rsw.quantity "입고 수량", sku.length "길이", sku.width "너비", sku.height "높이", sku.weight "무게", wus.userid "원바코드", CASE
WHEN sku.weight>55000 THEN '초고중량'
WHEN sku.weight>30000 THEN '고중량'
WHEN sku.weight>5000 THEN '중량'
ELSE '저중량'
END "무게 분류", CASE
WHEN (
GREATEST(
sku.length, sku.width, sku.height
) >= 1950
) THEN '오버사이즈'
WHEN sku.length >= 2560
OR sku.width >= 3389
OR sku.height >= 1341 THEN 'NON'
ELSE 'TOTA' END "상품 타입"
FROM ods.receive_station_work_logs rsw
JOIN ods.wms_users wus
ON
rsw.workeruserid = wus.id
JOIN ods.skus sku
ON
sku.id = rsw.skuid
JOIN ods.receive_station_placement rsp
ON
rsp.id = rsw.receivestationplacementid
JOIN ods.lots lot
ON
lot.id = rsp.cartid
JOIN ods.receive_stations rs
ON
rsp.receivestationid = rs.id
AND rs.receivetype = 'EACH'
WHERE lot.centerid = 12345
AND rsw.updatedat BETWEEN timestamp '2023-06-01 08:00:00.000' AND timestamp '2023-06-10 19:00:00.000'
--- 시간 설정 하면 됨
ORDER BY 3, 2
위 문구를 실행하면 아래와 같은 애러 메세지가 나오는데 어디를 수정해야할까요??
SQL Error [42883]: ERROR: function hour(timestamp without time zone) does not exist
Hint: No function matches the given name and argument types. You may need to add explicit type casts.
미리 감사드립니다.