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: select any row?

Re: select any row?

From: Turkbear <john.g_at_dot.spamfree.com>
Date: Mon, 01 Nov 2004 10:48:39 -0600
Message-ID: <1099327628.VFOZG7TFlvAimj0UA3Z2Lg@teranews>


Bricklen <bricklen_at_zyahoo.zcomz> wrote:

>Dirk Schwarzmann wrote:
>> Hi,
>>
>> hopefully this is not a FAQ:
>> (How) can I select just one row from a view? I am not interested in
>> the content, I merely need it (in my Java app) to get the structure of
>> the table / view. I know I can use
>>
>> SELECT * FROM MYVIEW WHERE ROWNUM < 2;
>>
>> but this quite slow. It seems like Oracle collects all rows in the
>> first run and than truncates all unnecessary rows before it returns
>> the rows to the user.
>> I guess the fastest way of receiving any row would be to tell Oracle
>> "just take the first row you find and return it, damn!"
>> How can I do so?
>>
>> Thanks in advance,
>> Dirk
>>
>>
>try
>select /*+ first_rows */ * from myview where rownum<2;

Also try

SELECT * FROM MYVIEW WHERE ROWNUM = 1; But much depends on the view's code.. Received on Mon Nov 01 2004 - 10:48:39 CST

Original text of this message

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