Created
May 12, 2020 19:36
-
-
Save genakim/576e45cb42f66c345ec7d36756166ef6 to your computer and use it in GitHub Desktop.
Пример функции MySQL
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
create | |
definer = root@`::1` function updatePublicWorksDate(serviceLogId int, date date, dateId varchar(255)) returns date | |
BEGIN | |
IF (dateId = 'REFERRAL_DATE') THEN | |
UPDATE m_service_public_works mspw | |
SET mspw.REFERRAL_DATE = date | |
WHERE mspw.SERVICE_LOG_ID = serviceLogId; | |
END IF; | |
IF (dateId = 'PW_SENT_DATE') THEN | |
UPDATE m_service_public_works mspw | |
SET mspw.PW_SENT_DATE = date | |
WHERE mspw.SERVICE_LOG_ID = serviceLogId; | |
END IF; | |
IF (dateId = 'PW_DENY_DATE') THEN | |
UPDATE m_service_public_works mspw | |
SET mspw.PW_DENY_DATE = date | |
WHERE mspw.SERVICE_LOG_ID = serviceLogId; | |
END IF; | |
IF (dateId = 'PW_STOP_DATE') THEN | |
UPDATE m_service_public_works mspw | |
SET mspw.PW_STOP_DATE = date | |
WHERE mspw.SERVICE_LOG_ID = serviceLogId; | |
END IF; | |
IF (dateId = 'PW_USE_DATE') THEN | |
UPDATE m_service_public_works mspw | |
SET mspw.PW_USE_DATE = date | |
WHERE mspw.SERVICE_LOG_ID = serviceLogId; | |
END IF; | |
RETURN date; | |
END; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment