请帮助我如何迁移到Postgres以下使用NOT REGEXP_LIKE的代码在Oracle中:
UPDATE TBL_RESOURCEAVAILUPLOAD
SET IS_VALID_AVAILABILITY = 0,
ERROR_CODE = 'DATA-ERR',
ERROR_MESSAGE = CONCAT(ERROR_MESSAGE,' Start date or end date is not in proper format. It should be in MM/DD/YYYY format.,')
WHERE ( **NOT REGEXP_LIKE** (STARTDATE, '(0[0-9]|1[0-2])/(0[0-9]|1[0-9]|2[0-9]|3[0-1])/([0-9][0-9][0-9][0-9])')
OR
**NOT REGEXP_LIKE** (ENDDATE, '(0[0-9]|1[0-2])/(0[0-9]|1[0-9]|2[0-9]|3[0-1])/([0-9][0-9][0-9][0-9])') )
AND BATCH_ID = 21354
AND COUNTRY_ID = '76';
答案 0 :(得分:0)
请试试这个
UPDATE TBL_RESOURCEAVAILUPLOAD
SET IS_VALID_AVAILABILITY = 0,
ERROR_CODE = 'DATA-ERR',
ERROR_MESSAGE = CONCAT(ERROR_MESSAGE,' Start date or end date is not in proper format. It should be in MM/DD/YYYY format.,')
WHERE (
STARTDATE !~ '(0[0-9]|1[0-2])/(0[0-9]|1[0-9]|2[0-9]|3[0-1])/([0-9][0-9][0-9][0-9])'
OR ENDDATE !~ '(0[0-9]|1[0-2])/(0[0-9]|1[0-9]|2[0-9]|3[0-1])/([0-9][0-9][0-9][0-9])'
)
AND BATCH_ID = 21354
AND COUNTRY_ID = '76';