This query works in mysql but I am not sure how to write the same query in redshift / postgresql.
update customer_Details set
customer_No = NULL
WHERE customer_No NOT REGEXP '^[[:digit:]]{12}$'
You need to use !~ operator. Something like this should work:
UPDATE
customer_details
SET
customer_no = NULL
WHERE
customer_No !~ '^[[:digit:]]{12}$';
NOT REGEXPwith!~. You can shorten the regex pattern further to^\d{12}$