RE: fetch out of sequence

  • From: "Anthony Molinaro" <amolinaro@xxxxxxxx>
  • To: <oracle-l@xxxxxxxxxxxxx>
  • Date: Mon, 23 Aug 2004 13:39:33 -0400

The syntax is fine, it's just that a and b no longer exist outside the
parenthesis.

 update (
   select a.last_name a_last_name, b.last_name b_last_name
       from emp a, person b
        where a.emp_id=3Db.person_id
   )
   set a_last_name=3Db_last_name;


 - ant

-----Original Message-----
From: Gogala, Mladen [mailto:Mladen.Gogala@xxxxxxxx]=20
Sent: Monday, August 23, 2004 1:35 PM
To: 'oracle-l@xxxxxxxxxxxxx'
Subject: RE: fetch out of sequence


Completely incorrect syntax. You cannot update a column=20
From one table with a column from another just like that. Rewrite that
as a short PL/SQL script, and everything will Be fine. Nice try, but no
cigar.

--
Mladen Gogala
A & E TV Network
Ext. 1216


-----Original Message-----
From: Paula_Stankus@xxxxxxxxxxxxxxx
[mailto:Paula_Stankus@xxxxxxxxxxxxxxx]=20
Sent: Monday, August 23, 2004 1:31 PM
To: Paula_Stankus@xxxxxxxxxxxxxxx; oracle-l@xxxxxxxxxxxxx
Subject: RE: fetch out of sequence


Rewriting into an update - I am testing a multiple column - join update:

  1  update
  2  (select a.last_name, b.last_name
  3     from emp a, person b
  4      where a.emp_id =3D3D b.person_id)
  5* set a.last_name =3D3D b.last_name
SQL> desc person;
 Name                                      Null?    Type
 ----------------------------------------- -------- =3D
----------------------------
 PERSON_ID                                          NUMBER
 LAST_NAME                                          VARCHAR2(50)
 FIRST_NAME                                         VARCHAR2(50)
 LOADDATE                                           DATE

SQL> desc emp;
 Name                                      Null?    Type
 ----------------------------------------- -------- =3D
----------------------------
 EMP_ID                                             NUMBER(38)
 LAST_NAME                                          VARCHAR2(50)
 FIRST_NAME                                         VARCHAR2(50)
 LOADDATE                                           DATE


When I execute the above update, I get the error:

set a.last_name =3D3D b.last_name
                  *
ERROR at line 5:
ORA-00904: "B"."LAST_NAME": invalid identifier

----------------------------------------------------------------
Please see the official ORACLE-L FAQ: http://www.orafaq.com
----------------------------------------------------------------
To unsubscribe send email to:  oracle-l-request@xxxxxxxxxxxxx put
'unsubscribe' in the subject line.
--
Archives are at //www.freelists.org/archives/oracle-l/
FAQ is at //www.freelists.org/help/fom-serve/cache/1.html
-----------------------------------------------------------------
----------------------------------------------------------------
Please see the official ORACLE-L FAQ: http://www.orafaq.com
----------------------------------------------------------------
To unsubscribe send email to:  oracle-l-request@xxxxxxxxxxxxx
put 'unsubscribe' in the subject line.
--
Archives are at //www.freelists.org/archives/oracle-l/
FAQ is at //www.freelists.org/help/fom-serve/cache/1.html
-----------------------------------------------------------------

Other related posts: