dbTalk Databases Forums  

Update question

comp.databases.oracle comp.databases.oracle


Discuss Update question in the comp.databases.oracle forum.



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

Default Update question - 09-27-2004 , 07:42 PM






What wrong with such query:

update MY_TABLE
set FIELD_ONE = 'A'
where FIELD_TWO in (select FIELD_TWO
from MY_TABLE
where rownum < 11
order by FIELD_THREE )

The query return such error:
ORA-00907: missing right parenthesis

I know that the problem because of the "order by" but why?

And if I need to update only specify portion (for example first 10 records)
what to do?
I can use PL/SQL , cursor , but can I do using single query?

Thanks



Reply With Quote
  #2  
Old   
Feilone Tong
 
Posts: n/a

Default Re: Update question - 09-29-2004 , 10:28 AM






The select clause doesn't return the result as you are expecting.
The "ORDER" logic is applied AFTER 10 records is retrieved from MY_TABLE.

So there is no way to use 1 simple SQL to complete your operation.

Wing

"Jul" <julia.sats (AT) sympatico (DOT) ca> ¦b¶l¥ó
news:Nr26d.4808$MD5.395214 (AT) news20 (DOT) bellglobal.com ¤¤¼¶¼g...
Quote:
What wrong with such query:

update MY_TABLE
set FIELD_ONE = 'A'
where FIELD_TWO in (select FIELD_TWO
from MY_TABLE
where rownum < 11
order by FIELD_THREE )

The query return such error:
ORA-00907: missing right parenthesis

I know that the problem because of the "order by" but why?

And if I need to update only specify portion (for example first 10
records)
what to do?
I can use PL/SQL , cursor , but can I do using single query?

Thanks





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.