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: Simple update query from joined tables

Re: Simple update query from joined tables

From: Niall Litchfield <niall.litchfield_at_dial.pipex.com>
Date: Thu, 1 Aug 2002 21:22:17 +0100
Message-ID: <3d499879$0$237$cc9e4d1f@news.dial.pipex.com>


"Tim C" <NOTCornwell_at_NOTcs.NOTcornell.NOTedu> wrote in message news:aic468$si0$1_at_news01.cit.cornell.edu...
> $10 to you - if you think you can solve it.

SQL> create table tab1(id number,string varchar2(20));

Table created.

SQL> create table tab2(id number,string2 varchar2(20), string3 varchar2(50));

Table created.

SQL> insert into tab1 values(1,'i claim');

1 row created.

SQL> insert into tab1 values(2,'but not really');

1 row created.

SQL> insert into tab2 values(1,' the ten quid',null);

1 row created.

SQL> commit;

Commit complete.

SQL> update tab2
  2 set string3 = (select string||string2 from tab1,tab2 where tab1.id=tab2.id);

1 row updated.

SQL> commit;

Commit complete.

SQL> select id,string3 from tab2;

        ID STRING3

---------- --------------------------------------------------
         1 i claim the ten quid

NB this is not a complete solution to the more general problem but should give you a few pointers.

--
Niall Litchfield
Oracle DBA
Audit Commission UK
*****************************************
Please include version and platform
and SQL where applicable
It makes life easier and increases the
likelihood of a good answer
******************************************
Received on Thu Aug 01 2002 - 15:22:17 CDT

Original text of this message

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