Open Source Tutorials - Open Source Training
Open source training & tutorials from experienced, passionate people
chrome icon firefox icon ie icon opera icon safari icon Sings in these Browsers
A- A A+

By A Web Design

Welcome, Guest
Username Password: Remember me

Updating multiple rows of a table at once
(1 viewing) (1) Guest
All your queries regarding PL / SQL will be solved in this forum
  • Page:
  • 1
TOPIC:

Updating multiple rows of a table at once

Updating multiple rows of a table at once 1 year, 3 months ago #502

  • isaac
  • OFFLINE
  • Senior Boarder
  • Posts: 64
  • Karma: 0
Hi,

I am writing a stored procedure which fills out all columns in a table, say Table A with one query except for one column, say column 'ABC' in that table. I have to load this left out column using a different query that is referring to some other tables. How can I update this column 'ABC' with all its rows of data coming from a different query?

Thanks!!

Re: Updating multiple rows of a table at once 1 year, 3 months ago #509

  • sandhya
  • OFFLINE
  • Senior Boarder
  • Posts: 42
  • Karma: 0
If you post an update with a create table and insert statements it would help... I think you want to update a table with a select from another table using a join... is that correct?

update customer c
set customer_name = (
select customer_name
from another_customer_table a
where a.customer_id = c.customer_id_from_original_customer_table
)
where c.customer_id in(select customer_id from another_customer_table)

The where clause is only needed if you don't want to update missing customer_ids to null.
  • Page:
  • 1
Time to create page: 1.04 seconds
OSV Newsletter


Receive HTML?

NOTE: To prevent subscription to the OSV newsletter, uncheck the checkbox above.
Guest Blog for OSV
Free Ebook Download