Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: rownum

Re: rownum

From: DA Morgan <damorgan_at_x.washington.edu>
Date: Fri, 07 Jan 2005 10:03:13 -0800
Message-ID: <41decdb3$1_2@127.0.0.1>


Niall Litchfield wrote:

> DA Morgan wrote:
>

>>fitzjarrell_at_cox.net wrote:
>>
>>
>>>db2group88_at_yahoo.com wrote:
>>>
>>>
>>>>so if i want to do a insert into a new table where data is from
>>>
>>>another
>>>
>>>
>>>>table  from row 2 to row 10, what should be right query?
>>>
>>>
>>>insert into mynewtable
>>>select a.col1, a.col2, a.col3, a.col4 from
>>>(select rownum rn, col1, col2, col3, col4 from mytable) a
>>>where a.rn between 2 and 10;
>>>
>>>Substitute the proper columns from your source table (all of them)

>
> for
>
>>>the col1, col2, col3, col4 placeholders in BOTH queries.
>>>David Fitzjarrell
>>
>>Surely this was a classroom assignment.

>
>
> As David's reply gives a 'solution' that inserts indeterminate rows
> into the new table yet demonstrates insert...select and subqueries I
> rather like it. A smart student will read it and determine what he
> needs to do, a not so smart student will copy and paste and then later,
> assuming they have a competent instructor who marks it wrong, might not
> be quite so willing to post homework without at least describing it so.
> Niall Litchfield
> Oracle DBA
> http://www.niall.litchfield.dial.pipex.com

Can't disagree but if it were my student I'd want a bit more hint and less code.

-- 
Daniel A. Morgan
University of Washington
damorgan_at_x.washington.edu
(replace 'x' with 'u' to respond)


----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= East/West-Coast Server Farms - Total Privacy via Encryption =---
Received on Fri Jan 07 2005 - 12:03:13 CST

Original text of this message

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