This discussion is archived
1 Reply Latest reply: Sep 26, 2013 2:34 AM by sybrand_b RSS

Issue with the update statement

Sarma12 Newbie
Currently Being Moderated

Hi all,


I am facing issue with the update statement ..

I have edw.dim_cdh_customer table, within which I have a column called Flag, now, I want to update the status with the value from another table shared.cdh_hz_parties, which is present in another schema.  Find below the command which I have written..   edw.dim_cdh_customer table will be having multiple records for a particular party number.. its more or less a parent child relation (wherein edw.dim_cdh_customer table is a child & shared.cdh_hz_parties is a parent, but without any foriegn & primary key constraints)


update edw.dim_cdh_customer set dim_cdh_customer.status=(select status from shared.cdh_hz_parties) f where f.party_number = dim_cdh_customer.party_number


Can you please help.

  • 1. Re: Issue with the update statement
    sybrand_b Guru
    Currently Being Moderated

    This is elementary SQL and it should have been posted in the SQL forum.


    It should have read


    update edw.dim_cdh_customer c

    set dim_cdh_customer.status=(select status

                                                 from shared.cdh_hz_parties f

                                                 where f.party_number = c.party_number


    where exists

    (select 'x'

      from shared.cdh_hz_parties f

    where f.party_number = c.party_number



    Sybrand Bakker

    Senior Oracle DBA



  • Correct Answers - 10 points
  • Helpful Answers - 5 points