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: 2 Dumb newbee questions

Re: 2 Dumb newbee questions

From: Turkbear <john.g_at_dot.spamfree.com>
Date: Fri, 16 Jul 2004 15:51:14 -0500
Message-ID: <jmfgf0hrcfevk8ppi0nssjq8fq1kmq91kj@4ax.com>

Inline Comments:
Matthias Weiß <matthiasUNDERSCOREweiss_at_gmx.at> wrote:

>Hallo!
>
>I know a little about SQL but I stumbled over code on an oracle server which
>I don't understand:
>
>create table foo as
> select no, um
> from bar
> where 1=2
>
>As far as I get it, this creates the new table foo with the colums no and um
>which have the same types as the colums with the same name in the table
>bar. But what is this "where 1=2" ???
>

The where 1=2 will prevent any data form being copied from bar to foo, so only the structure of the table is created - it could be any expression that will always be FALSE.
>And one last:
>
>update
>(
> select
> ck.col_1,
> ck.col_2,
> col_3,
> ck.col_4,
> col_5
> from foo i, bar ck
> where i.col_1 = ck.col_1
> and i.col_2 = ck.col_2
>)
>set col_1 = col_3,
> col_2 = col_5
>
>
>How do I see in this construct which table is updated?
>The inner select statement returns 5 columns, but only 2 get updated, so
>what's the point of this select?
>

Not familiar with that syntax so can't help with that one.

>Thanx in advance for any help!!!
>
>Ciao
>matthias
Received on Fri Jul 16 2004 - 15:51:14 CDT

Original text of this message

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