Re: Yet another newbie question

From: Ed Prochak <edprochak_at_gmail.com>
Date: Thu, 3 Sep 2009 11:35:38 -0700 (PDT)
Message-ID: <18b57a59-61a8-4147-81d5-b80e98f3e4e3_at_z30g2000yqz.googlegroups.com>



On Sep 3, 11:19 am, Sashi <small..._at_gmail.com> wrote:
> Thanks for the pointers, guys.
>
> This is what I've come up with:
>
> update A
> set a.col1 = 'something'
> where exists
> (select 1
> from B
> where a.col2>=b.col2 and a.col3<=b.col3 )
>
> Is my syntax correct for what I'm aiming to do?

Looks like it. For syntax, it us usually quicker to try it.

> As for what I'm aiming to do, I hope it's clear.
>
> I have two tables, A and B and a column in A needs to be updated to
> true if two columns in A (source and destination) fall in a range,
> given that all ranges are in table B as two columns (start and end).

Seems reasonable.
>
> And the syntax I quoted is from Sybase, which is where I acquired it.

Hence my comment about SQL extension (ie, non-standard) syntax. Don't blame Oracle for not following Sybase extensions by saying Oracle is not following the standard SQL syntax.

>
> Thanks,
> Sashi

You are welcome. I hope that helped.
  Ed Received on Thu Sep 03 2009 - 13:35:38 CDT

Original text of this message