Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8729459
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T08:50:17+00:00 2026-06-13T08:50:17+00:00

Following is my query: UPDATE DSOPI_PERSON_ADDR_RULE ADDR SET ADDR.DEPT_NAME = CASE WHEN regexp_like (UPPER(addr.src_address_line1),

  • 0

Following is my query:

UPDATE DSOPI_PERSON_ADDR_RULE ADDR
SET ADDR.DEPT_NAME =
  CASE
    WHEN regexp_like (UPPER(addr.src_address_line1),     'DEP|DPT$|ABT|DIP.|DIPART|AFDEL|AVDEL|AVD.|DIV|PGRD|PGP|PPG')
    AND ADDR.ORG_NAME IS NOT NULL
    THEN ADDR.SRC_ADDRESS_LINE1
    WHEN regexp_like (UPPER(addr.src_address_line2), 'DEP|DPT$|ABT|DIP.|DIPART|AFDEL|AVDEL|AVD.|DIV|PGRD|PGP|PPG')
    AND ADDR.ORG_NAME IS NOT NULL
    THEN ADDR.SRC_ADDRESS_LINE2
    WHEN regexp_like (UPPER(addr.src_address_line3), 'DEP|DPT$|ABT|DIP.|DIPART|AFDEL|AVDEL|AVD.|DIV|PGRD|PGP|PPG')
    AND ADDR.ORG_NAME IS NOT NULL
    THEN ADDR.SRC_ADDRESS_LINE3
    WHEN regexp_like (UPPER(addr.src_address_line4), 'DEP|DPT$|ABT|DIP.|DIPART|AFDEL|AVDEL|AVD.|DIV|PGRD|PGP|PPG')
    AND ADDR.ORG_NAME IS NOT NULL
    THEN ADDR.SRC_ADDRESS_LINE4
    ELSE NULL
 END;

What I would like to do is, when the case condition is true I would like to make the respective address lines NULL. Is there any way to achieve it with this code?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T08:50:18+00:00Added an answer on June 13, 2026 at 8:50 am

    One option you have is to add additional CASE statements for each address field:

    The code is duplicated, but this allows you to set the address lines to null when the condition is met.

    UPDATE DSOPI_PERSON_ADDR_RULE ADDR
    SET ADDR.DEPT_NAME =
       CASE
          WHEN regexp_like (UPPER(addr.src_address_line1),
             'DEP|DPT$|ABT|DIP.|DIPART|AFDEL|AVDEL|AVD.|DIV|PGRD|PGP|PPG')
             AND ADDR.ORG_NAME IS NOT NULL
             THEN ADDR.SRC_ADDRESS_LINE1
          WHEN regexp_like (UPPER(addr.src_address_line2), 
             'DEP|DPT$|ABT|DIP.|DIPART|AFDEL|AVDEL|AVD.|DIV|PGRD|PGP|PPG')
             AND ADDR.ORG_NAME IS NOT NULL
             THEN ADDR.SRC_ADDRESS_LINE2
          WHEN regexp_like (UPPER(addr.src_address_line3), 
             'DEP|DPT$|ABT|DIP.|DIPART|AFDEL|AVDEL|AVD.|DIV|PGRD|PGP|PPG')
             AND ADDR.ORG_NAME IS NOT NULL
             THEN ADDR.SRC_ADDRESS_LINE3
          WHEN regexp_like (UPPER(addr.src_address_line4), 
             'DEP|DPT$|ABT|DIP.|DIPART|AFDEL|AVDEL|AVD.|DIV|PGRD|PGP|PPG')
             AND ADDR.ORG_NAME IS NOT NULL
             THEN ADDR.SRC_ADDRESS_LINE4
          ELSE NULL
       END
       , ADDR.SRC_Address_Line1 =
            CASE
               WHEN regexp_like (UPPER(addr.src_address_line1),     
                  'DEP|DPT$|ABT|DIP.|DIPART|AFDEL|AVDEL|AVD.|DIV|PGRD|PGP|PPG')
                  AND ADDR.ORG_NAME IS NOT NULL
                  THEN NULL
               ELSE ADDR.SRC_Address_Line1
            END
       , ADDR.SRC_Address_Line2 =
            CASE
               WHEN regexp_like (UPPER(addr.src_address_line2),     
                  'DEP|DPT$|ABT|DIP.|DIPART|AFDEL|AVDEL|AVD.|DIV|PGRD|PGP|PPG')
                  AND ADDR.ORG_NAME IS NOT NULL
                  THEN NULL
               ELSE ADDR.SRC_Address_Line2
            END
       , ADDR.SRC_Address_Line3 =
            CASE
               WHEN regexp_like (UPPER(addr.src_address_line3),      
                  'DEP|DPT$|ABT|DIP.|DIPART|AFDEL|AVDEL|AVD.|DIV|PGRD|PGP|PPG')
                  AND ADDR.ORG_NAME IS NOT NULL
                  THEN NULL
               ELSE ADDR.SRC_Address_Line3
            END
       , ADDR.SRC_Address_Line4 =
            CASE
               WHEN regexp_like (UPPER(addr.src_address_line4),     
                  'DEP|DPT$|ABT|DIP.|DIPART|AFDEL|AVDEL|AVD.|DIV|PGRD|PGP|PPG')
                  AND ADDR.ORG_NAME IS NOT NULL
                  THEN NULL
               ELSE ADDR.SRC_Address_Line4
            END;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've run the following query: UPDATE main_table, reference_table SET main_table.calc_column = (CASE WHEN main_table.incr
I have the following query: UPDATE #Temp_SessionItem SET [Status] = CASE WHEN ([AddressFK] IS
What is the order of evaluation in the following query: UPDATE tbl SET q
I have the following query: SET @q = 12; UPDATE `table` SET qty =
I have to execute the following query in Android SQLite UPDATE player SET rank=rank+1
I am trying to execute the following query. update share set holder = 22
What is wrong with the following PostgreSQL query? UPDATE project_project SET project_project.create_date = assignments.start_date
Imagine the following sql query: UPDATE MYTABLE SET COL2 = (SELECT COL2 + 1
The following query does not update the datetime field: update table SET EndDate =
I have the following query: UPDATE PRODUCT SET FIXEDCOST = (Select PRICE from PRODUCTPROGRAM

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.