How to select  random and unique number

hi all
suppose i have millions of rows in emp table
i want to select group of empno
group of records would be 10
all records uniquely selected
make sure all records are selected in any Group
thanks

BluShadow wrote:
Solomon Yakobson wrote:
3360 wrote:
It is the definition of random that the each value generated has an equal chance of being generated again. A coin toss is random despite the result only having two values.Absolutely. Except one little thing. The above applies if we randomly pick from same set. Now OP asked to randomly select group of objects. This is same as you have a set of unique objects and you randomly pick one and put it in your pocket. Then you randomly pick another object and put it in your pocket. So you end up with a UNIQUE set of randomly picked objects in your pocket. Now DBMS_RANDOM allows to specify low & high value but it doesn't allow to provide something like "pick N values" or except list to mimick "put in your pocket" part. That is why we have to write something like I suggested to OP.
SY.In that case it should just be an answer like...
select * from tablename where rownum <= 10because the order is not guaranteed without an order by clause and therefore that's just as random as needed to meet the requirements. ;)hi BluShadow
rownum surely give unique number of records but it will not A RANDOM....
thanks

Similar Messages

  • Hi Everyone,  I am using iPhone5, my question in how to display name and contact number both stored for incoming and outgoing calls? If I have saved five different numbers with a same name, how do I recognise that from which number caller is calling?

    Hi Everyone,  I am using iPhone5, my question in how to display name and contact number both stored for incoming and outgoing calls? If I have saved five different numbers with a same name, how do I recognise that from which number caller is calling?

    I have friends all over Europe, does it matter what number they use to call me? Nope! All incoming calls are free for me.
    The only time you ever have to worry about which number is if you get charged for incoming domestic/international calls.
    You can tag their number (work/home/iphone) and that may show on the CallerID accordingly.
    It should show, John Doe
    underneath,    work/home/mobile
    For example:
    http://shawnblanc.net/images/img-0009-1.png

  • How Can I Print A Unique Number on a Series of PDF documents?

    I have a weird question that I could not find an answer for via search previous questions. I essentaily have a PDF flyer that I want to print X copies of (where as X is a number, 50, 150, whateve amount I need at the moment). I want to have a unqiue number printed on each copy (sort of like a serial number). So Copy 1 would have a number of  909, copy 2 would have a new numbe,r say 910. The unique number could be random or in series (not important which). I'm wondering if this is possible within Adobe Acrobat X or InDesign CS5?

    Yes, it's possible with Acrobat, but it requires a bit of scripting. You'll
    need to set up:
    - A print-only text field
    - A script that will launch before the file is printed and update that
    field (either by incrementing it or by giving it a random value)
    - A script that sends the same file X times to the printer (you can't just
    print X copies, because then the field won't update)

  • How to work even and odd number query

    Plz explain how below worked even and odd query
    2 ) why used subquery after from and which time we can use(what time of out put)
    even
    select * FROM (SELECT ROW_NUMBER() OVER(ORDER BY stud_id) as row ,grno,stud_id from stud_Enrollment) d
     WHERE d.row %2=0   
    odd
    select * FROM (SELECT ROW_NUMBER() OVER(ORDER BY stud_id) as row ,grno,stud_id from stud_Enrollment) d
     WHERE d.row %2=1

    Row_Number function returns the sequential number of a row
    (By using partition of a result set, starting at 1 for the first row in each partition)
    >> why used subquery after from and which time we can use(what time of out put)
    When we need sequntial numbers, we can use row_number function. Put it into derived table and use this derived table after FROM clause (Same way it is used in your query)
    CREATE TABLE stud_Enrollment (
    grno int,
    stud_id int,
    stud_name varchar(20)
    INSERT INTO stud_Enrollment
    VALUES (101, 511, 'Dheeraj'), (112, 521, 'Vaibhav'), (132, 522, 'Lalit'), (124, 564, 'Amogh'), (143, 598, 'Sushrut')
    SELECT * FROM stud_Enrollment
    -- Result of your table
    --grno stud_id stud_name
    --101 511 Dheeraj
    --112 521 Vaibhav
    --132 522 Lalit
    --124 564 Amogh
    --143 598 Sushrut
    -- Now we need to find out the rows which are at even position, ie row should be at position of 0,2,4,6,8 etc..
    -- But we don't have sequential number here in your table result
    -- So we can create one new column by using row_number function
    SELECT
    ROW_NUMBER() OVER (ORDER BY stud_id) AS row, --> additiona "row" column
    grno,
    stud_id,
    stud_name
    FROM stud_Enrollment
    -- We got "row" column in below output
    --row grno stud_id stud_name
    --1 101 511 Dheeraj
    --2 112 521 Vaibhav
    --3 132 522 Lalit
    --4 124 564 Amogh
    --5 143 598 Sushrut
    -- Now above table is used after FROM clause. It uses row column in WHERE part
    SELECT
    FROM (SELECT
    ROW_NUMBER() OVER (ORDER BY stud_id) AS row,
    grno,
    stud_id,
    stud_name
    FROM stud_Enrollment) d
    WHERE d.row % 2 = 0
    --row grno stud_id stud_name
    --2 112 521 Vaibhav
    --4 124 564 Amogh
    -Vaibhav Chaudhari

  • How to select text and pictures together in word processing mode?

    Hello,
    I have written about 20 chapters of a book in word processing mode. Each chapter has many pictures, carefully positioned within the text.
    Each chapter is a separate pages file.
    Now i want to put them together into one single document and have a big problem.
    When i press cmd+A to select everything in one document in order to copy and paste it into another document, i can either select the text OR the pictures, not both together.
    In Layout mode it is possible, but not in word processing mode.
    Does anybody know how to select both in word processing mode or how to transform a word processing document into a layout mode document?
    Or is there a way to put together a word processing document from a number of single documents?
    Thanks in advance
    funthomas

    I still use word processing for just about everything. The first two versions of Pages only had word processing. I think all of the complaints/requests about the "always-present" text layer led the developers to add page layout. I think they would have been better off adding another application (like AppleWorks' draw module compared to AppleWorks' word processing module.

  • How to append calling and called number with translation rules?

    Hello,
    I have one question about digit manipulations.
    How to append calling number and called number with IOS commands?
    For example, when 123 dials 45678, translations have to be performed and the new called number to be 12345678.
    Thank you,
    I will vote this conversation.

    It is not possible with translation rules.
    However, you can do that with a TCL/IVR script.

  • How to select usr_login and him resource, it resource, login in this resource OIM

    Hello im need help in how to select in database sql usr_login and him resource, it resource, login in this resource OIM&

    It is your only option if you want to get rid of that other user account. It seems the system is Hard Set to boot to that account. How and why I have not Idea but the first thing you should of done was Restoring it to the Original OS, if it was not Mt Lion to begin with, in doing so getting rid of all other accounts and files from that other account.
    Time to Bit the Bullet and Erase the drive completely and reinstall the original shipping version of OS X on that system.
    Anton Mironenko wrote:
    Reinstalling the OS would be too extreme. I already have many programs installed, and I tuned a lot of params. Data migration is another pain.
    I hope, it is possible to solve this issue in another way.

  • How to select copy and paste an image that has a layer mask

    Hi,
    when I select, copy and paste the image it still has the content that I removed using the layer mask.
    I want to paste it over another psd whilst maintaing the transparency.
    Any help would be much appreciated.
    PSD is at
    http://sdrv.ms/16DoRft
    The small jpg is because I don't know what you will see in the skydrive psd
    Michael

    Wow that was so easy!
    Thanks!
    I spent at least half and hour trying to figure out why it wouldn't work.
    Michael

  • ERP sales order additional fields: how to select data and edit it.

    Hi Gurus,
    I need to add in the CRM Web UI SAP ERP fields like VBAK-TAXK1. I followed the steps as described in the SAP note nr 1224179.
    The field is present in the CRM WEB UI, but there is not the selection list and it is not editable.
    I checked the field in the structure TDS_HEAD_COMV, TDS_HEAD_COMC and it is in the table LORD_MAPPING with this entries:
    OBJECT :               HEAD
    FIELD :                   TAXK1
    FIIELD_INTERNAL: VBAK-TAXK1
    REPID:                    SAPMV45A
    DYNNR:                 4440     
    I have also checked the values of these two parameters in the VA transaction:
    CALL_FUNCTION equal blank
    CALL_ACTIVITY equal blank                                   
    In the CRM system I created the custom field and I renamed it with the same name of ERP field in the structure:
    INCL_EEW_ERP_ADMINH_V
    INCL_EEW_ERP_ADMINH_V_X
    Thanks for the Help
    Daniele
    Edited by: Daniele Piazza on Jan 24, 2011 3:17 PM

    Hi,
    Call transaction SFW5 on ERP system, click Continue on POP-UP.
    Check if ENTERPRISE_BUSINESS_FUNCTIONS->LOG_SD_SIMP_02 is active. If it is not active, select it and go to the menu->Activate .
    Edited by: Daniele Piazza on Apr 1, 2011 9:19 AM

  • Displaying 3 random and unique numbers out of 6

    The following program gives me the results in the output panel because I used trace.  The problem is that I want these numbers displayed when I click on a button.  The numbers should not duplicate when the button is clicked, for example not "3, 3, 2" but "3, 2, 5".  Here is the program that randomly selects numbers (which by the way is not mine):   (I'll happily donate 15$ to the animal charity of your choice for whoever can give me a hand with this problem, thanks!)
    var mynumbers:Array = ["1","2","3","4","5","6"];
    var mystuff:Array = [];
    var randomCount:Number = 3;
    var r:Number;
    for (var i = 0; i<randomCount; i++)
    r = Math.floor(Math.random() * mynumbers.length);
    mystuff[mystuff.length] = mynumbers.splice(r,1);
    trace(mystuff);
    //and here is my button code
    generate_btn.addEventListener(MouseEvent.CLICK, coco);
    //3.;
    function coco(event:MouseEvent):void

    Hi
    I am trying to replace the numbers in the random script with pictures. I thought that all I had to do was replace the numbers in the array with pictures name.
    I am getting the output as picture names instead of actual images. I just started flash a few weeks ago and would appreciate where I am going wrong in the code below. I know, it's a bit ambitious for someone who has no experience in programming or mathematical background. I think, that is the only way to learn. By asking the experts in programming. Otherwise, I just give up, and go back to watching TV.
    var mynumbers:Array = ["alfa.jpg","beta.jpg","alfa1.jpg","alfa2.jpg","alfa3.jpg","alfa4.jpg"];
    var randomCount:Number = 3;
    function shuffle(a:Array) {
        var p:int;
        var t:*;
        var ivar:int;
        for (ivar = a.length-1; ivar>=0; ivar--) {
            p=Math.floor((ivar+1)*Math.random());
            t = a[ivar];
            a[ivar] = a[p];
            a[p] = t;
    //and here is my button code
    generate_btn.addEventListener(MouseEvent.CLICK, coco);
    //3.;
    function coco(event:MouseEvent):void
    shuffle(mynumbers);
    for(var i:int=0;i<randomCount;i++){
    if(!this["tf_"+i]){
    this["tf_"+i]=new TextField();
    this["tf_"+i].text = mynumbers[i];
    addChild(this["tf_"+i]);
    this["tf_"+i].y = i*40;

  • Choosing serveral random and unique numbers

    Hi
    I'd like to select 9 random numbers out of a set of let's say
    1-20. They can't repeat and each has to be saved into a different
    variable P1-P9.
    Any ideas?
    Thanks

    Make an array of the numbers 1 through 20.
    Shuffle the array.
    Take off as many numbers as you need.
    Search the forums for shuffle to find out how to shuffle the
    array.

  • Import acting strangely.. selecting random and previously imported images

    Whenever I try to do an import, looking for new images on my existing harddrive, I am seeing strange activity that I cannot understand.
    First, Lightroom selects thousands of images (all?) to import, then it automatically begins reducing the number of selected images to a much smaller, but seemingly random subset of images that have already been imported.  If I go ahead and import, and then try the same process, I get another seemingly random set of previously imported images.
    Any ideas what is happening?
    Doug
    (I am new to this forum, may not understand all the protocal for asking questions like this)

    Lightroom 4.2, Mac OSX 10.7.5

  • How to edit tracks and disc number?

    I have the iPod Classic 160GB, and I have a Windows 7 desktop PC which has the latest version of iTunes. I am not sure what is the latest, but I always have it up to date.
    I have a lot of playlists for my iPod, and I have it labeled by the albums, so in that particular playlist are my songs. Some are multi disc meaning some are two, or more, or some are a complete box set. I know for a fact I'm not doing this right. In my playlist, I drag over every disc of that album, and track numbers, and disc numbers are one big line of songs. Pretty much I would like to group my disc 1 together, and when all tracks play of disc 1 then it plays the next disc, and so on. Could someone please explain how in steps?
    Thank you,

    I have to sleep... I live in the UK. Your last two posts were at 02:16 and 05:59 respectively. Like anyone else helping out here I'm doing so in my spare time. And you should have all the information by now... For a multi-disc CD give each disc the correct disc number, then give each disc the same album name. If you choose the right column to sort on (Album) the CDs are listed in order with the tracks listed in order within each CD.
    In the screenshot you posted you should enable the Track # and Album Artist columns so you can see clearly what is going on.
    In fact for a fuller picture, turn on the columns for Track #, Disk #, Album, Sort Album, Artist, Sort Artist, Album Artist and Sort Album Artist so you can see all the factors influencing the sort.
    If you sort on the Album column, set to read Album by Artist, then sorting is controlled by the first non-empty value from the following fields: Sort Album Artist, Album Artist, Sort Artist, Artist, then by Sort Album or Album, then Disk #, then Track #.
    tt2

  • How to display even and odd number ranges between two given inputs.

    Hi Every one,
    I am just started my career in sap abap and trying to find the solution for this.
    I am trying to display number range using select options, but I am getting an error "Memory low leave the transaction before taking a break".
    Example: when I give two number 2 and 10 , it should display set of all even and odd numbers in that range.
    Below is the code logic that I am using:
    data: a type i,
             b type i,
             c type i,
             d type i,
             num type i.
    select-options: in for num.
    a = inp-low.
    b=inp-high.
    c = inp-low mod 2.
    d = inp-high mod 2.
    while a <=b and c = 0.
    write: "even numbers:', a.
    b = a + 1.
    endwhile.
    while a <=b and c <> 0.
    write: "odd numbers:', b.
    b = a + 1.
    endwhile.
    Any help will be much appreciated.

    This is your logic...changed:
    data: a type i,
              b type i,
              c type i,
              d type i,
              num type i.
    data: even type i,
           odd  type i.
    select-options: in for num.
    a = in-low.
    b = in-high.
    c = a mod 2.
    if c is INITIAL. "It measn a is even
       even = a.
       odd  = a + 1.
    else.
       odd  = a.
       even = a + 1.
    endif.
    * Even
    a = even.
    while a <= b.
       write: / 'even numbers:', a.
    *  b = a + 1.
       a = a + 2. "The next even number
    endwhile.
    * Odd
    a = odd.
    while a <= b .
       write: / 'odd numbers:', a.
       a = a + 2. "The next odd number
    endwhile.

  • Pls help : How To select fields and data from user_table for each tablename

    Please help with the query to generate a output which selects the code,meaning,inuse for each table in the user_table that has "CODED" as a part of table name.
    User table has some 800 table that contains CODED in the tablename.
    Desc of the table:
    DESCPTION:
    Name Null? Type
    SHORT_NAME NOT NULL VARCHAR2(20)
    CODE NOT NULL VARCHAR2(4)
    MEANING NOT NULL VARCHAR2(240)
    IN_USE VARCHAR2(1)
    NOTES VARCHAR2(2000
    UNITS NOT NULL VARCHAR2(1)
    AMOUNT NOT NULL VARCHAR2(3)
    CONVERTED VARCHAR2(1)
    RUN_NAME VARCHAR2(30)
    But all the table have code, meaning,in_use fields.
    O/P format :
    TABLE_NAME CODE MEANING IN_USE
    Help me pls.

    Not 100% sure what you want. If you want to see all the tables that have all three of those columns, then you could do something like:
    SELECT table_name, 'CODE', 'MEANING', 'IN_USE'
    FROM user_tab_columns
    WHERE column_name = 'CODE' and
          table_name like '%CODED%'
    INTERSECT
    SELECT table_name, 'CODE', 'MEANING', 'IN_USE'
    FROM user_tab_columns
    WHERE column_name = 'MEANING' and
          table_name like '%CODED%'
    INTERSECT
    SELECT table_name, 'CODE', 'MEANING', 'IN_USE'
    FROM user_tab_columns
    WHERE column_name = 'INUSE' and
          table_name like '%CODED%'If you want to select those three columns from each of the tables, then you could do something like this.
    Create a command file called, for example, makesel.sql that looks like:
    SET PAGES 0 lines 500 trimspool on feedback off;
    spool sel.sql;
    prompt spool selout.txt;
    SELECT 'SELECT '''||table_name||''', code, meaning, in_use FROM '||
           table_name||';'
    FROM (SELECT table_name
          FROM user_tab_columns
          WHERE column_name = 'CODE' and
                table_name like '%CODED%'
          INTERSECT
          SELECT table_name
          FROM user_tab_columns
          WHERE column_name = 'MEANING' and
                table_name like '%CODED%'
          INTERSECT
          SELECT table_name
          FROM user_tab_columns
          WHERE column_name = 'INUSE' and
                table_name like '%CODED%')
    prompt 'spool off;'
    spool off;
    @sel.sqlAt the sqlplus prompt run the file using @makesel.sql. This will create another file called sel.sql containing the commands to select those three columns from each table that has all three columns, then after the new file is created, it runs the file (@sel.sql). The output will be spooled to a file called selout.txt.
    HTH
    John

Maybe you are looking for

  • Error in time evaluation

    Dear All, time evaluation is throwing an error msg "No entry in table T001P for key" for only one employee in the time evaluation display log. Its happening in the initialization part in time evaluation. for example, If i run the time evaluation for

  • Memory on laptop getting low

    I'm sorry I can't find an answer to my question. If there is a post somewhere that answers it, feel free to post the link. My question is this: The memory on my iBook is getting dangerously low and it's the songs in iTunes that is taking up a good ch

  • Error while creating excise invoice to return Delivery (J1IS)

    Dear all, Plz help to solve this problem. After MIGO. I have done return delivery to vendor(Movt-122). With ref to the return delivery doc I am trying to create excise invoice to send to vendor in J1IS. but error appears as Vendor not related to mate

  • How do I get the Nomad Jukebox 3 to work with MediaSource Organiz

    I tried to transfer songs, but MediaSource Organizer (Version 2.02.06)does not show the Jukebox 3 file library. I downloaded the latest version (CMS_PCAPP_LB_2_03_29.exe) of the application and when I tried to install it, I got the following message:

  • PPro CS6, error reading *.psd files

    My old NLE laptop is dying, so I built a new desktop earlier this year and loaded Production Premium CS6 on it as my second copy. Laptop is retired now, more or less, and the desktop is all I use. This installation went on without a hitch, took my se