dbTalk Databases Forums  

Yet another newbie question

comp.databases.oracle.misc comp.databases.oracle.misc


Discuss Yet another newbie question in the comp.databases.oracle.misc forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Sashi
 
Posts: n/a

Default Yet another newbie question - 09-02-2009 , 09:40 AM






Hi all,
I'm using a standard SQL command but Oracle seems to have a different
version.

update A,B
set a.col1 = 'something'
where a.col2>=b.col2 and a.col3<=b.col3

Why doesn't this seem to work?

Thanks,
Sashi

Reply With Quote
  #2  
Old   
Michel Cadot
 
Posts: n/a

Default Re: Yet another newbie question - 09-02-2009 , 10:17 AM






"Sashi" <smalladi (AT) gmail (DOT) com> a écrit dans le message de news: f4b15387-b8cc-4ce9-a9d2-fb8d74d88e1f...oglegroups.com...
Quote:
Hi all,
I'm using a standard SQL command but Oracle seems to have a different
version.

update A,B
set a.col1 = 'something'
where a.col2>=b.col2 and a.col3<=b.col3

Why doesn't this seem to work?

Thanks,
Sashi
Because it is not in the Oracle SQL syntax.
http://download.oracle.com/docs/cd/B...7.htm#i2067715

Regards
Michel

Reply With Quote
  #3  
Old   
Ed Prochak
 
Posts: n/a

Default Re: Yet another newbie question - 09-02-2009 , 11:02 AM



On Sep 2, 10:40*am, Sashi <small... (AT) gmail (DOT) com> wrote:
Quote:
Hi all,
I'm using a standard SQL command but Oracle seems to have a different
version.

update A,B
set a.col1 = 'something'
where a.col2>=b.col2 and a.col3<=b.col3

Why doesn't this seem to work?

Thanks,
Sashi
Actually, that doesn't look like standard SQL to me. The standard says

UPDATE table name ...
where table name can be a base table or a view.

So I assume you learned "standard SQL" on some other DBMS that
extended the standard a little. So as Michel mentioned, look up the
Oracle syntax. It actually more closely follows the SQL Standard.

Ed

Reply With Quote
  #4  
Old   
Sashi
 
Posts: n/a

Default Re: Yet another newbie question - 09-03-2009 , 10:19 AM



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?
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).

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

Thanks,
Sashi

Reply With Quote
  #5  
Old   
Ed Prochak
 
Posts: n/a

Default Re: Yet another newbie question - 09-03-2009 , 01:35 PM



On Sep 3, 11:19*am, Sashi <small... (AT) gmail (DOT) com> wrote:
Quote:
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.

Quote:
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.
Quote:
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.

Quote:
Thanks,
Sashi
You are welcome. I hope that helped.
Ed

Reply With Quote
  #6  
Old   
Terry Dykstra
 
Posts: n/a

Default Re: Yet another newbie question - 09-03-2009 , 02:06 PM



"Ed Prochak" <edprochak (AT) gmail (DOT) com> wrote

On Sep 3, 11:19 am, Sashi <small... (AT) gmail (DOT) com> wrote:
Quote:
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.

Quote:
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.
Quote:
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.

Quote:
Thanks,
Sashi
You are welcome. I hope that helped.
Ed

===============

That is standard Ansi syntax. Nothing Sybase specific. Just took Oracle a
while to adopt Ansi standards.

--
Terry Dykstra

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.