Looking for the oracle equivalent of T-SQL 'SELECT TOP n'

Hi,
I'm looking for the Oracle equivalent of T-SQL 'SELECT TOP n'
and can't find any. There is SAMPLE(n) function but it supposed
to pick up random values and I'm not sure if it's possible to
make it select top values. Please help 8-)
Thanx

Hi Marina.
Oracle does not have a functionality like SQL Server for TOP
selection. The ROWNUM option should be used with great care and
you may get unreliable results.
Try looking at Metalink
Doc ID: 291065.999
Doc ID: 267329.999
- They discuss this issue, and solutions.

Similar Messages

  • Looking for the right application.

    What is the equivalent of the Notepad on the Macbook Air?

    I am supposing you are looking for a text editor, and NOT a word processor.
    I was one looking for an equivalent, and found some difficulty in finding one. IMHO, Apple devastated TextEdit with the advent of Lion. They added "features" which removed its ability to act as a simple text editor. For a while, I simply installed a copy of the Snow Leopard version, but was on the lookout for a super-simple editor for editing txt files, and not adding any formatting, paragragh styles and other features which can ruin batch and text files. I also did not want anything which littered the disk with "versions".
    If you are truly looking for the closest equivalent to "Notepad", I have found an app in the Mac App Store, curiously called "Notepad", a simple TXT Editor By Kupon.BG Ltd. It is even better than Apple's old editor.
    Just do a search within the app store for "notepad", and select the first entry...the one by Kupon. Or use this link.

  • 11g equivalent for the oracle bpm 10g global interactive

    Hi,
    What is the 11g equivalent for the oracle bpm 10g global interactive activity?
    Thansk!

    The Initiator Task is the 11g equivalent to Global Interactive Activity.
    Find more information here
    http://download.oracle.com/docs/cd/E14571_01/doc.1111/e15176/human_task_bpmpd.htm
    and here
    http://jamessmith73.wordpress.com/oracle-soa-bpm-11g/simple-bpm-task-initiator/

  • What is the Oracle equivalent of the Microsoft Access FIRST function?

    Using: Oracle 10gR2 RAC on SUSE Linux 9 (10.2.0.3)
    In the process of converting a Microsoft Access database to Oracle, an Access query is using the FIRST function.
    What is the Oracle equivalent of the Microsoft Access FIRST function?
    In the attempt to convert, the Oracle FIRST_VALUE function was used. However, the same results was not achieved.
    Thanks,
    (BLL)
    Query:
    h2. ACCESS:
    SELECT
         TRE.GCUSNO,
         UCASE([DCUSNO]) AS DCUSNO_STD,
         *FIRST(UCASE([DNAME])) AS DNAME_STD*,
         *FIRST(UCASE([DADDR])) AS DADDR_STD*,
         *FIRST(UCASE([DCITY])) AS DCITY_STD*,
         TRE.DSTATE,
         FIRST(TRE.DZIP) AS DZIP,
         TRE.DREGN,
         TRE.DDIST,
         TRE.DSLSMN,
         TRE.DCHAIN,
         TRE.MARKET,
         TRE.MKTPGM,
         TRE.EUMKT
    FROM
         TRE
    GROUP BY
         TRE.GCUSNO,
         UCASE([DCUSNO]),
         TRE.DSTATE,
         TRE.DREGN,
         TRE.DDIST,
         TRE.DSLSMN,
         TRE.DCHAIN,
         TRE.MARKET,
         TRE.MKTPGM,
         TRE.EUMKT;
    h2. ORACLE:
    SELECT DISTINCT
    TRE.GCUSNO,
    UPPER(TRIM(TRE.DCUSNO)) AS DCUSNO_STD,
    UPPER(TRIM(TRE.DNAME)) AS DNAME_STD,
    UPPER(TRIM(TRE.DADDR)) AS DADDR_STD,
         FIRST_VALUE(UPPER(TRIM(TRE.DNAME)) IGNORE NULLS) OVER (ORDER BY TRE.GCUSNO) AS DNAME_STD,
         FIRST_VALUE(UPPER(TRIM(TRE.DADDR)) IGNORE NULLS) OVER (ORDER BY TRE.GCUSNO) AS DADDR_STD,
         FIRST_VALUE(UPPER(TRIM(TRE.DCITY)) IGNORE NULLS) OVER (ORDER BY TRE.GCUSNO) AS DCITY_STD,
    TRE.DSTATE,
    TRE.DZIP,
    FIRST_VALUE(UPPER(TRIM(TRE.DZIP)) IGNORE NULLS) OVER (ORDER BY TRE.DZIP ASC) AS DZIP,
    TRE.DREGN,
    TRE.DDIST,
    TRE.DSLSMN,
    TRE.DCHAIN,
    TRE.MARKET,
    TRE.MKTPGM,
    TRE.EUMKT
    FROM CRM.TREUP100R TRE
    GROUP BY
    TRE.GCUSNO,
    UPPER(TRIM(TRE.DCUSNO)),
    TRE.DNAME,
    TRE.DADDR,
    TRE.DCITY,
    TRE.DSTATE,
    TRE.DZIP,
    TRE.DREGN,
    TRE.DDIST,
    TRE.DSLSMN,
    TRE.DCHAIN,
    TRE.MARKET,
    TRE.MKTPGM,
    TRE.EUMKT;

    A slight correction to odie's post. I think you want min not max to replicate the Access first function, but see below to be sure. So:
    min(upper(trim(tre.dname))) keep (dense_rank first order by tre.gcusno) as dname_std
    user10860953 wrote:How does one ignore null values?The min and max functions will ignore nulls automatically, so if there is a null value in tre.dname, it will not be be returned, unless all of the values are null. For example:
    SQL> WITH t AS (
      2     SELECT 65 id, 'ABCD' col FROM dual UNION ALL
      3     SELECT 37, 'DEFG' FROM dual UNION ALL
      4     SELECT 65, 'DEFG' FROM dual UNION ALL
      5     SELECT 65, null FROM dual UNION ALL
      6     SELECT 70, null FROM dual UNION ALL
      7     SELECT 70, null FROM dual UNION ALL
      8     SELECT 37, 'ABC' from dual)
      9  SELECT id,
    10         MIN(col) keep (DENSE_RANK FIRST ORDER BY id) min_dname_std,
    11         MAX(col) keep (DENSE_RANK FIRST ORDER BY id) max_dname_std
    12  FROM t
    13  GROUP BY id;
            ID MIN_ MAX_
            37 ABC  DEFG
            65 ABCD DEFG
            70John

  • Where to look for the computed stats collected using gather_table_stats

    I have used analyze command before but new to gather_table_stats.
    I have executed gather_table_stats procedure as given below. Now where to look for the statistics estimated and also what are the important parameters I need to look in the stats ? Any major difference between analyze & gather_table_stats ?
    SQL> exec dbms_stats.gather_table_stats(ownname => 'TPDBS01A', tabname => 'x_TPD_STG_TL_SF_LEGAL_OWN
    ER' , estimate_percent => 50, method_opt => 'for all indexed columns size auto');
    PL/SQL procedure successfully completed.

    The command "analyze table" is deprecated for gathering optimizer statistics. But it is still the only command to get for instance the chained rows. This command is no longer maintained for new features, so if you use this command to collect statistics, it might not collect all needed numbers for the optimizer so the plan could be wrong.
    The package dbms_stats is collecting all the figures that the optimizer needs to genererate an optimal access plan. All new database features are incorporated only here.
    The statistics numbers can be found in the normal tables like USER|ALL|DBA_TABLES, ...TAB_COLUMNS, ...INDEXES, ...IND_COLUMNS etc. There you can find for instance number of rows in table, clustering factor for indexes and more numbers like this. They are not really needed for us human beings, they are used by the optimizer to generate the access plan.

  • Error when installing 9.0.1.4.0 patch set for the Oracle Database Server.

    Hi to all.
    Currently, i am trying to install patches for portal server.
    The server OS is Sun Solaris 8.
    We are using Oracle9iAS.
    Now, we are installing 9.0.1.4.0 patch set for the Oracle Database Server.
    We managed to install the patch, but have problem with the Post Install Action.
    We managed to run
    -ALTER SYSTEM ENABLE RESTRICTED SESSION;
    -@rdbms/admin/catpatch.sql
    -ALTER SYSTEM DISABLE RESTRICTED SESSION;
    -CONNECT / AS SYSDBA
    -update obj$ set status=5 where type#=29 and owner#!=0;
    -commit;
    But, when we come to the next command, which is to shutdown, it gives us like
    this..
    SQL> update obj$ set status=5 where type#=29 and owner#!=0;
    1402 rows updated.
    SQL> commit;
    Commit complete.
    SQL> shutdown immediate
    Database closed.
    Database dismounted.
    ORA-00604: error occurred at recursive SQL level 1
    ORA-01219: database not open: queries allowed on fixed tables/views only
    We tried to startup the database..it gives us this error..
    SQL> startup
    ORA-01081: cannot start already-running ORACLE - shut it down first
    So, we tried to shutdown again..
    SQL> shutdown immediate
    ORA-01089: immediate shutdown in progress - no operations are permitted
    I been informed that this is maybe a Database problem related. Any ideas?
    Best Wishes,
    Rushdan Md Saad.

    Patchsets could be obtained (only) from http://metalink.oracle.com
    You need to have valid CSI for access.
    P.S: Sorry Werner, I didn't see you post.
    Message was edited by:
    Ivan Kartik

  • How to download and Install bos.loc.utf.EN_US Package for the Oracle BI locale setting english-usa language in Windows 7 64bit

    OBIEE 11G Installation error during configuration steps with message "Distributing Repository" failed.
    I searched lot of forums but all they say, install bos.loc.utf.EN_US Package for the Oracle BI locale setting english-usa language. From where we can download this package.
    Thanks in advance.

    But I am assuming that when I make the installer, the 32-bit Run Time Engine is appened with the installer, as show below
    Since from the picture you can see its including the support installers from '\Program Files (x86)\'
    The application runs queries to fetch data from database in SQL server 2008, and for that I am using a Microsoft SQL Native Client 2008 R2 64 bit ( this is the only version that installs on either PC, even the one on which I developed my LV Application).
    I am not using any driver, only toolkits for reports - and for that I un-checked the "Remove unused polymorphic VI instances" when making the executable, otherwise LV throws up an exception that share variable are not being included.
    Yes I did reboot every time after I ran the installation.
    Still getting the same error.

  • 12c agent install fails with error - The plug-in configuration for the oracle.sysman.oh monitoring plug-in may have failed

    Hi,
    I am trying to install 12c agent on windows 7 64 bit server by following m.note   .
    It is failing with Agent Configuration failed, please see below error message.
    INFO: length of temp is2
    INFO: Return value:C:\/Oracle/12.1.0.3.0_AgentCore_233/core
    INFO: ** Agent Port Check completed successfully.**
    INFO: ERROR: The Management Agent configuration failed. The plug-in configuration for the oracle.sysman.oh monitoring plug-in may have failed, or this plug-in may not be present in the Management Agent software. Ensure that the Management Agent software has the oracle.sysman.oh monitoring plug-in, if not then retry the operation. If the agent software has the oracle.sysman.oh monitoring plug-in, view the plug-in deployment log C:\Oracle\12.1.0.3.0_AgentCore_233\core\install\logs to check if the plug-in configuration for the oracle.sysman.oh monitoring plug-in failed.
    INFO:
    INFO: perform - mode finished for action: configure
    INFO:
    INFO: You can see the log file: C:\Oracle\12.1.0.3.0_AgentCore_233\core\12.1.0.3.0\cfgtoollogs\oui\configActions2014-10-03_08-48-15-AM.log
    INFO:
    INFO: C:\Oracle\12.1.0.3.0_AgentCore_233>exit /b 3
    INFO: Plugin homes:
    INFO: Plugin homes:
    INFO: C:\Oracle\12.1.0.3.0_AgentCore_233\core\12.1.0.3.0\oui\bin\runConfig.bat ORACLE_HOME=C:\Oracle\12.1.0.3.0_AgentCore_233\core\12.1.0.3.0 RESPONSE_FILE=C:\Oracle\12.1.0.3.0_AgentCore_233\core\12.1.0.3.0\agent.rsp ACTION=configure MODE=perform COMPONENT_XML={oracle.sysman.top.agent.11_1_0_1_0.xml} RERUN=true completed with status=3
    SEVERE: ERROR: Agent Configuration Failed
    Thanks,

    Looks like , J2EE is having a problem connecting to the DB.Pls. chk. the following
    -If you have configured the loop-back adapter , if installing on a local system & updated the /etc/host file with your ip address and host name.
    or if the system is part of some n/w group and has ip address assigned ?
    -Jdk 1.4 version is installed in your system
    -Enough free Disk space available in the system
    -How much RAM your system has which windows version you are using  ?
    -Is the DB is coming up properly ? its error related to this. check the logs.
    -If the ports used by sap install / run used by other services running on the system ? & user have admin. privileges on the system .
    Pls. update with your findings on above same , for the step next ...
    Thanks ,
    Uppal

  • I'm trying to make a time sheet and include a grid, but I'm having a hard time figuring out how to print a full grid on my spreadsheet.  There are options for shaded grids but I want a defined grid, and I have spent the last 2 hours looking for the answer

    I'm trying to make a time sheet and include a grid, but I'm having a hard time figuring out how to print a full grid on my spreadsheet.  There are options for shaded grids but I want a defined grid, and I have spent the last 2 hours looking for the answer.  Any ideas?

    Hi Cynthia,
    Are you planning to have this table do any of the calculation, or is is to be used as the electronic equivalent of a sheet of paper with a grid printed on it—a place to record the data.
    For your seven column table:
    Are you using one or more rows at the top of the table to label the data below? If so, you might want this row (or these rows) to be set as Header Rows.
    Are you using the leftmost column to label the rows? If so, you may want this column to be a Header column.
    The default table supplied on the "Blank" templates contains one header row and one header column. If you need more (or fewer) Header rows or columns, select the table, then go Table (menu) > Header Rows > (choose the number you need). Repeat to set the number of Header Columns.
    To make a seven column table from the table supplied by default, click on any cell in column H (The eighth column), and drag right to add more cells to the selection, until you get to the last column of the table. With these cells selected, Go Table > Delete Columns.
    To make the remaining seven columns fit across a single page:
    Go View > Show Print View to show the table as it would appear when printed to paper.
    Select the table by clicking its icon in the Sheets List to the left (easy method), OR by carefully clicking on the outside boundary of the table itself (fiddley method).
    With the table selected, you will see square white handles at each corner and at the middle of each side (including the top and bottom).
    With the mouse, grab the handle in the middle of the right side of the table and drag right (or left) until the table just fits onto the width of the defined page.
    With the table still selected, set the thickness and colour of the cell boundaries using the Gaphics Inspector (as described by Jerry), or using the Stroke, Thickness and Color Well controls in the Format bar above the working portion of the Window.
    Regards,
    Barry

  • Looking for the best solution for downgrading a database from 11.2 to 11.1

    we have an install of 11.2 grid and have made several attempts at adding 11.1 binaries and using the 11.2 infrastructure. we patched, etc... but all of our attempts failed in getting 11.1 to work across the cluster.
    we have decided to make all of the installs version 11.1.
    I am looking for the most straight forward approach to migrate our 11.2 down to 11.1 with the least amount of downtime.
    thanks, tom

    Hi Tom;
    Please check below note
    Master Note For Oracle Database Downgrade [ID 1151427.1]
    How To Downgrade From Database 11.2 To Previous Release [ID 883335.1]
    I belive it will answer all your question.
    Please also check below links:
    http://blogs.oracle.com/db/2010/09/master_note_for_oracle_database_downgrade_doc_id_11514271.html
    Regard
    Helios

  • Hi - I am looking for the Adobe Illustrator 2014 1.2 (or .0.2) bugfix update for Mac - and it is not visible in the Adobe Creative Cloud Packager (Mac version). The only update visible is Illustrator CC 2014.1  - which is what introduced the bugs.

    Hi - I am looking for the Adobe Illustrator 2014 1.2 (or .0.2) bugfix update for Mac - and it is not visible in the Adobe Creative Cloud Packager (Mac version). The only update visible is Illustrator CC 2014.1  - which is what introduced the bugs.
    The only thing that I can think of that might be causing the issues that I have a Mac Mini on Mavericks.
    Dave

    Hi
    I have discovered that my question above is a non-question. A user triggered by looking at the below article about Illustrator 2014 cc 17.0.2
    http://helpx.adobe.com/illustrator/release-note/illustrator-17-0-2-release-notes.html 
    He had recently upgraded from wht we now know is 18.0 to 18.1 which is the latest version. He read the above artic
    le and supposed that it was a bug fix release for his version - because the v17 ov18 number is not often displayed. It is usually just 2014 CC.
    I have asked him to post a bug report about Adobe Illustrator CC 2014.1
    Dave

  • I cannot add a Wi-Fi guest network. Gone to Utilities Airport Utilities and all get is an image/browser of my Airport Extreme. Looking for the browser which has the title Wireless but cannot find anywhere. I need help?

    I cannot add a Wi-Fi guest network. Gone to Utilities>Airport Utilities and all I get is an image/browser of my Airport Extreme. Looking for the browser window which has the title Wireless but cannot find anywhere. What am I doing wrong?

    Open AirPort Utility. The first screen looks something like this:
    Click on the AirPort Extreme and another screen will appear. Click Edit, then the window with the Wireless tab will appear.
    If you do not see these screens, you will need to start over and configure your AirPort again.

  • Problem with my program looking for the settings file in the wrong folder

    I have been writing a simple FTP file uploader, what I want to do is be able to select the files I want to upload in windows explorer and then right click and click the menu item and it launches the program and passes the files paths that I have selected to it.
    So I use this in the windows registry "C:\Program Files\Java\jre1.6.0_03\bin\java.exe -jar D:\BenFTP\BenFTP.jar %1"
    It launches fine and has no problem finding the files I want to upload. The problem is that it tries to look for the settings file in the same folder that the file I am try to upload is in. Which it's not suppose to do since the settings file is in the same folder that the .jar is in.
    Edited by: ColNewman on Feb 5, 2008 6:55 PM

    So, you're looking for your settings file in your current working directory. There's no way to set the CWD in your registry entry (is there?) so that isn't a practical thing to do. Presumably you're using a File object or a FileReader or something? Can't do that.
    One alternative is to look for the settings file in the classpath. You can get a URL to a file in the classpath like this:URL settings = this.getClass().getResource("/settings.xml");Or you can get an InputStream to read the file by using the getResourceAsStream method. You would have to make sure that your executable jar file contained a Class-Path entry that specified the right directory, because the directory the jar is contained in isn't automatically in an executable jar's classpath.
    Another alternative is to ask the user where the settings file is supposed to be, and put an entry in the Preferences (java.util.prefs) to remember that location.

  • When I try to reset my iPad mini it keeps asking for  a passcode! have tried restoring, connecting to iTunes and looked for the 'set up as new iPad' notification, but nothing is working? can anyone help please?

    I know my passcode is correct but when I try to reset my iPad mini it keeps asking for  a passcode! have tried restoring, connecting to iTunes and looked for the 'set up as new iPad' notification, but nothing is working? can anyone help please?

    If the iPad was running iOS 7,  iCloud: Find My iPhone Activation Lock in iOS 7
    http://support.apple.com/kb/HT5818
    How can I unlock my iPad if I forgot the passcode?
    http://www.everymac.com/systems/apple/ipad/ipad-troubleshooting-repair-faq/ipad- how-to-unlock-open-forgot-code-passcode-password-login.html
    iOS: Device disabled after entering wrong passcode
    http://support.apple.com/kb/ht1212
    How can I unlock my iPad if I forgot the passcode?
    http://tinyurl.com/7ndy8tb
    How to Reset a Forgotten Password for an iOS Device
    http://www.wikihow.com/Reset-a-Forgotten-Password-for-an-iOS-Device
    Using iPhone/iPad Recovery Mode
    http://ipod.about.com/od/iphonetroubleshooting/a/Iphone-Recovery-Mode.htm
    Saw this solution on another post about an iPad in a school environment. Might work on your iPad so you won't lose everything.
    ~~~~~~~~~~~~~
    ‘iPad is disabled’ fix without resetting using iTunes
    Today I met my match with an iPad that had a passcode entered too many times, resulting in it displaying the message ‘iPad is disabled – Connect to iTunes’. This was a student iPad and since they use Notability for most of their work there was a chance that her files were not all backed up to the cloud. I really wanted to just re-activate the iPad instead of totally resetting it back to our default image.
    I reached out to my PLN on Twitter and had some help from a few people through retweets and a couple of clarification tweets. I love that so many are willing to help out so quickly. Through this I also learned that I look like Lt. Riker from Star Trek (thanks @FillineMachine).
    Through some trial and error (and a little sheer luck), I was able to reactivate the iPad without loosing any data. Note, this will only work on the computer it last synced with. Here’s how:
    1. Configurator is useless in reactivating a locked iPad. You will only be able to completely reformat the iPad using Configurator. If that’s ok with you, go for it – otherwise don’t waste your time trying to figure it out.
    2. Open iTunes with the iPad disconnected.
    3. Connect the iPad to the computer and wait for it to show up in the devices section in iTunes.
    4. Click on the iPad name when it appears and you will be given the option to restore a backup or setup as a new iPad (since it is locked).
    5. Click ‘Setup as new iPad’ and then click restore.
    6. The iPad will start backing up before it does the full restore and sync. CANCEL THE BACKUP IMMEDIATELY. You do this by clicking the small x in the status window in iTunes.
    7. When the backup cancels, it immediately starts syncing – cancel this as well using the same small x in the iTunes status window.
    8. The first stage in the restore process unlocks the iPad, you are basically just cancelling out the restore process as soon as it reactivates the iPad.
    If done correctly, you will experience no data loss and the result will be a reactivated iPad. I have now tried this with about 5 iPads that were locked identically by students and each time it worked like a charm.
    ~~~~~~~~~~~~~
    Try it and good luck. You have nothing more to lose if it doesn't work for you.
     Cheers, Tom

  • How to look for the Table Name

    Hi Friends,
    Sometimes we need to download the table for the desired information if the same is not available from a particular report. How to look for the table name? Is there a report or a particular feild, where we can find the name of the particular table?
    Thanks for the assistance.
    Regards

    Hi Friend,
    If you want to see the structures then go to SE11. Sometimes it happens that you cannot find the table names but only fields. In such case, if you want to find the Table names which is not available, then go to SE90.
    Abap Dictionary > Fields > Table Fields.
    Now Enter the Field name in Right Hand Side of the screen then Execute. You will see the all tables by which that Fields are used.
    Regards,
    Jigar

Maybe you are looking for