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 6531761
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T09:55:02+00:00 2026-05-25T09:55:02+00:00

My question would be a little too long so: TL;DR Oracle correlated update doesn’t

  • 0

My question would be a little too long so:

TL;DR

Oracle correlated update doesn’t work as expected, leaving victim column without changes.

Tables structure

STUDENTS:

STUDENT_ID  NUMBER(5,0)         
LAST_NAME   VARCHAR2(15 BYTE)   
FIRST_NAME  VARCHAR2(15 BYTE)   
MIDDLE_NAME     VARCHAR2(15 BYTE)   
FINANCIAL_AID   NUMBER(7,2) 
CLASS_NO    VARCHAR2(15 BYTE)       
SPECIALITY      VARCHAR2(100 BYTE)

CLASSES:

CLASS_NO    VARCHAR2(15 BYTE)   
SPECIALITY_NO   NUMBER(5,0) 

SPECIALITIES:

SPECIALITY_ID   NUMBER(5,0)
SPECIALITY_NAME VARCHAR2(40 BYTE)

Task

Basicaly, I need to augment STUDENTS table’s column SPECIALITY with SPECIALITY_NAME values (right now it’s populated with nulls) which I can get via connecting with CLASSES and SPECIALITIES tables (yep, I know that’s weird and will broke database normalization, but that’s the task).

So here is what I’m trying to do:

UPDATE STUDENTS S SET SPECIALITY = (SELECT SPECIALITY_NAME FROM 
  (SELECT * FROM STUDENTS NATURAL JOIN
    CLASSES NATURAL JOIN SPECIALITIES) ALLS
  WHERE S.STUDENT_ID = ALLS.STUDENT_ID)

Problem

Oracle says that N rows updated., hence query result seems to be ok, but SPECIALITY column in STUDENTS table still contains only nulls.

What am I doing wrong?

  • 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-05-25T09:55:03+00:00Added an answer on May 25, 2026 at 9:55 am

    Try this instead

    update students s set specialty = 
       (select sp.specialty_name from classes c
        join specialities sp
          on sp.speciality_number = c.speciality_number
        where c.class_no = s.class_no)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This question has been asked before, but I would like a little more detail
I'm troubled by this question for a long time now. I work in the
I am afraid that this question might be a little too broad, but I
Just a little question i had trouble googling the answer too. Is it possible
I thought this question would have already existed on SO, but then I couldn't
A simple answer to this super simple question would be great! Here is the
Question: How would one write a function to check and return whether or not
Question What would be a good (ideally, technical) reason to ever program some non-trivial
I would like to ask for more an opinion than a question: What would
Before I ask this question I would to apologise because of the fact that

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.