File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes Oracle update query question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Oracle update query question" Watch "Oracle update query question" New topic

Oracle update query question

Kevin P Smith
Ranch Hand

Joined: Feb 18, 2005
Posts: 362
Probably not the ideal forum to post this, but I know you tend to get quick resulst here so I thought I'd give it a go.

I have a tabel where I need to update a column, but I can only find the ID of that record by search a second table.

Basically the pseudo code query is...

Update table1 status='Effective' where table ID = X, X = table 1 child_id where table 2 master_id = '123456'

This is being executed on an Oracle DB.

Here is my attempt at the query, but I get a


Jeanne Boyarsky
author & internet detective

Joined: May 26, 2003
Posts: 32803

This forum is fine - it's about SQL.

I remember having to do a nested query for the other table in updates in Oracle for it to work. It's been a while, but this looks familiar.

[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
Paul Campbell
Ranch Hand

Joined: Oct 06, 2007
Posts: 338

or alternatively you can do this

I agree. Here's the link:
subject: Oracle update query question
It's not a secret anymore!