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 -> Help needed for the 'subquery returns multiple rows' problem

Help needed for the 'subquery returns multiple rows' problem

From: Peter Lowagie <Peter.Lowagie_at_posa.be>
Date: 1997/07/28
Message-ID: <01bc9ba2$67af9a20$e59ad2c1@plowagie>#1/1

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 Mon Jul 28 1997 - 00:00:00 CDT

Original text of this message

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