updating using SubQuery Problen

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • d4dyf786
    New Member
    • Aug 2008
    • 1

    updating using SubQuery Problen

    Below given Query using for updating a table
    it gives error = ORA - 00933 SQL command not properly ended.
    if below given query is incorrect , than kindly help to correct it.


    update normalised_even t_error
    set c_party_interna l_id=(
    select distinct service_id,serv ice_name from service_history sh,normalised_e vent_error nee
    where sh.service_name =nee.c_party_id
    and nee.c_party_int ernal_id is null
    and trunc(nee.charg e_start_date) > sysdate -35
    and nee.error_messa ge_id=2563
    and SERVICE_STATUS_ CODE=3
    ) d
    where d.service_name= c_party_id
    and SERVICE_STATUS_ CODE=3
    and sysdate between effective_start _date and effective_end_d ate
  • amitpatel66
    Recognized Expert Top Contributor
    • Mar 2007
    • 2358

    #2
    Your sub query select 2 columns and it is NOT POSSIBLE to update one column with 2 values.

    Your UPDATE query is incorrect and you need to change to sleect only one column in the subquery that you want to update with. Make these changes and post back in case of any issues

    Comment

    • Pilgrim333
      New Member
      • Oct 2008
      • 127

      #3
      Furthermore, you give an alias to the sub query you use to update the values and you use that in your where clause. I don't think that will work either.

      Pilgrim.

      Comment

      Working...