473,626 Members | 3,285 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

does sqlplus support :"select top 10 * from table1" syntax like MS SQL?

I would like to select the top 10 record from a table? How can I do it?
In MS SQL, it's easy using select top 10 from table1. But in oracle database,
I can't use top, anyone have any suggestions? Thanks!
Jul 19 '05 #1
1 27460

"mlke" <ml***@hotmail. com> wrote in message
news:df******** *************** ***@posting.goo gle.com...
I would like to select the top 10 record from a table? How can I do it?
In MS SQL, it's easy using select top 10 from table1. But in oracle database, I can't use top, anyone have any suggestions? Thanks!


I do not know SQL server, but I think that you want to do what is called Top
'N' Analysis. In Oracle you can do this through an inline view. I found the
explanation inserted at the bottom of this post on
http://www.orafaq.com/msgboard/serve...sages/7285.htm :

Best regards,

Jacob Grydholt Jensen

----

Posted by Barbara Boehmer (66.120.226.1) on April 05, 2003 at 02:13:35:

In Reply to: Is there any command similar to SQLSERVER TOP command in Oracle
posted by skrosuri on April 04, 2003 at 16:35:18:

In Oracle, top-n analysis is accomplished by first ordering the values in an
inner sub-query, then selecting the rows from an outer query. You can use
DESC in the order by clause to get the last row, rather than the first row.
Oracle does not guarantee the row returned until or unless an order by
clause has been applied.


SELECT *

FROM (SELECT column_names

FROM table_name

ORDER BY column_name DESC)

WHERE ROWNUM <= 1

/
Jul 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
8605
by: Phil Powell | last post by:
Has anyone here ever done a case where you have a select multiple form element and you have to do both server-side and client-side validation? I am honestly not sure how to do it in Javascript (I keep getting errors thrown that I can't verify because the form processes onto itself too quickly for me to check the Javascript errors) because the select multiple form element name has to be in the form of "var" because PHP will then recognize...
4
8410
by: Matt | last post by:
In ASP page, there is a "SELECT ALL" button, when user click it, it will select all checkboxes. I am not sure should I use client-side code to do that? the following is my approach but it didnt work. <script language="JavaScript"> function selectAllCheckBox() { //alert(document.addzone.c1.value); document.addzone.c1.value = "on"; } </script>
6
9333
by: GSteven | last post by:
(as formerly posted to microsoft.public.access.forms with no result) I've created a continuous form which is based on a straightforward table (ex - customers - 100 records). On the form there is a checkbox with a control source named "MARK" (boolean) from customer table. I can check and uncheck individual records fine. Then I created 2 command buttons named "Select All" and "Deselect All". The Onclick property of these buttons runs code...
2
5855
by: bhdvir | last post by:
Does anybody have any advice on selecting all records within a iif-statement? I have a form in which one has to state if all projects or just a selection of projects are to be used for a query. If "all projects" are required the query should show all records. In the example below the iif-statement should select all projects or just "projectnumber 2". I tried the following as criteria but none is working:
0
325
by: mlke | last post by:
I would like to select the top 10 record from a table? How can I do it? In MS SQL, it's easy using select top 10 from table1. But in oracle database, I can't use top, anyone have any suggestions? Thanks!
11
2009
by: bcurtu | last post by:
Hi, I have a BIIIIIG problem with the next query: cursor.execute(""" SELECT titem.object_id, titem.tag_id FROM tagging_taggeditem titem WHERE titem.object_id IN (%s) """,( eid_list))
41
4703
bre1603
by: bre1603 | last post by:
I have a continuous form in Access 2007 called “Leadership Contact List.” It has a checkbox control for each record (bound to a field in the underlying table) that is used to email or create mailing labels for the selected contacts. In the form header, there is a “Select All” checkbox control which (of course) selects all the checkboxes. The form also has a combo box in the header that filters the records according to “agency type.” What I...
0
1415
by: Utku | last post by:
Is it possible to add "select all" and "select none" buttons to MultiChoiceDialog in wxPython?
7
2123
Samishii23
by: Samishii23 | last post by:
I came across something in my code today that made me wonder if theres a way to basicly incorporate two statements into one using something like a "OR" logic. Basicly something like this: SELECT * FROM `table` WHERE `user` = "someUser" OR WHERE `email` = "something@bs.com" Don't bite my head off, i'm sure thats not proper MySQL syntax, just trying to get my point across. Thanks in advance.
0
8262
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8196
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8637
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8364
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6122
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4090
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4196
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2623
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1807
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.