Results 1 to 4 of 4
  1. #1
    Join Date
    Jan 2006
    Posts
    119

    Unanswered: Fetch First for Oracle

    In DB2, you can limit the number of rows returned in a query by appending:
    "FETCH FIRST n ROWS ONLY" where n is the number of rows you wish to return.

    Can something like this be done in Oracle?

  2. #2
    Join Date
    Nov 2003
    Posts
    2,933
    Provided Answers: 12
    SELECT *
    FROM ( your original query goes here )
    WHERE rownum < 42;

  3. #3
    Join Date
    Feb 2009
    Posts
    62
    You only need to put the query in brackets if it's got an order by clause, and you care about getting the first n rows from this ordered sequence.

    If you just want the first n rows that the database gets hold of, just do
    Code:
    SELECT <fields>
    FROM table
    WHERE <where clause>
    AND ROWNUM <= n

  4. #4
    Join Date
    Nov 2007
    Posts
    5

    Advice on Oracle needed

    Hi, I wanted to study Oracle from the starting level. I am completing new to Oracle and have lettle knowlege in programming. Although I work as PC supporter but mostly on Hardware. I have tried some courses online and not really satisfy with them, Please can any one refer me to any tutorial or learning institute that will works well for people in my category. Thanks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •