Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Help needed for the 'subquery returns multiple rows' problem

Re: Help needed for the 'subquery returns multiple rows' problem

From: Alan Slay <theslays_at_mindspring.com>
Date: 1997/07/30
Message-ID: <33deb4a9.5036905@news.mindspring.com>#1/1

My general rule of thumb is "if it is not simple, run to PL/SQL so that you can use cursors and logic". I have tried multiple subselects on table A to update multiple columns on table B, but only if it is quick and dirty. Otherwise, ProcedureBuilder here I come!

alanslay_at_iname.com

"Peter Lowagie" <Peter.Lowagie_at_posa.be> wrote:

>Good day to the members of this newsgroup,
>
>For six months i have been working with Oracle7 and with some programs of
>the Developer 200 pack. And by working with it i learned more about PL/SQL
>and how to use it.
>
>Unfortunately, I'm still having problems with updating a column based on
>values from another table. Up till now i more or less bypassed the problem
>by making two cursors and updating one cursor with the values contained in
>the other table.
>
>This brings me to the following question: Is it possible to use a subquery
>in an update statement with contains different values (as the values i need
>are not the same for the entire column).
>
>Example: update COMPANY
> set company_name = (select a.comp_name from temp a, temp2 b
> where a.id = b.id);
>
> Gevolg: ORA- ..... : subquery returns multiple rows
>
> If it can't be done then my last question is:
> is it possible to fetch the first row AGAIN from a current cursor
> (as i need the same values to check another table and closing and opening
>the same cursor seems a
> big waste of time)
>
>
>All tips, trics or tactics will be highly appreciated,
>
>Peter Lowagie
Received on Wed Jul 30 1997 - 00:00:00 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US