Home
TO_DATE and TO_TIMESTAMP should be used with a datetime format model
Rule description
- TO_DATE and TO_TIMESTAMP should be used with a datetime format model
Non-compliant Code Example
UPDATE CUSTOMERS
SET City=city,
ModificationDate = TO_TIMESTAMP(date_string) --Non compliant code (TO_DATE OR TO_TIMESTAMP is used without date-time format)
WHERE Id = customerId;
Compliant Code Example
UPDATE CUSTOMERS
SET City=city,
ModificationDate = TO_TIMESTAMP(date_string,'YYYY-MM-DD HH24:MI:SS') --Compliant code (TO_DATE OR TO_TIMESTAMP is used with date-time format)
WHERE Id = customerId;