I have 4 columns in my table. Now, since this is more of a data cleansing task, I am not really looking at performance that much. But still, I would like to know the possible options.
Take a look at the request below:
SELECT * FROM dsopi_person_addr_rule ADDR WHERE addr.src_address_line1 LIKE '%DEP%' OR addr.src_address_line2 LIKE '%DEP%' OR addr.src_address_line3 LIKE '%DEP%' OR addr.src_address_line4 LIKE '%DEP%';
Like DEP, I have 10 more matches. I need to repeat each match for all 4 address lines. Is there a better way to do this? I personally hate writing over and over again.
** Updated: Below is the answer
SELECT * FROM dsopi_person_addr_rule ADDR WHERE regexp_like (UPPER(addr.src_address_line1), 'DEP|DPT$|ABT|DIP.|DIPART|AFDEL|AVDEL|AVD.|DIV|PGRD|PGP|PPG')
source share