question to insert random generation between 1 to 5 numbers

Hello all;

I have the sample data
create table zone2
( ID varchar2(500)
);

insert into zone2
  (ID)
values
  ('A');

insert into zone2
  (ID)
values
  ('B');

insert into zone2
  (ID)
values
  ('C');
insert into zone2
  (ID)
values
  ('D');

insert into zone2
  (ID)
values
  ('E');

insert into zone2
  (ID)
values
  ('F');

insert into zone2
  (ID)
values
  ('G');
I use the insert select statement to transfer things in the table below
create table zone1
(
  ID varchar2(400),
  scanno number(30)

);
See my insert select below
insert into zone1 (ID, scanno)
select zone2.ID from zone2
My question is so fundamentally during my select insert, I want to be able to generate random numbers from 1 to 5, it can be in order descending or not and these random numbers will be used for field scanno in zone1, so basically that's what I want to see recorded in the table of the zone1
ID  scanno
A        1
B         2
C        3
D        4
E        5
F        1
G       2

If you really want random numbers

insert into zone1 (ID, scanno)
  select zone2.ID, floor( dbms_random.value(0,6) )
    from zone2

Justin

Tags: Database

Similar Questions

  • Random generation of time between a period of time in ColdFusion

    Hello

    I want to generate a random time between a certain period of time using coldfusion. For example, between 01:00 and 04:00 I want to generate a random time for example 01:12, 02:30 and so on. Please, help me to know how I should go about it. Thank you.

    Hello

    Please try this

    http://livedocs.Adobe.com/ColdFusion/6/CFML_Reference/functions-pt261.htm

  • Let a burn of LED on a random time between 3 and 7 seconds

    Hi all

    Probably, it's a matter of simpel for many of you, but not for me. I try to make a counter reaction time. And I hope someone can help me with the first part: the led must Flash on a random time between 3 and 7 seconds.

    After this need to measure the time between burning directed and by pressing the stop button

    Results ranking in a table

    After the display of ten measures of response time average.

    I hope someone can help me to launch it, I need it for school.

    Thank you!

    Matthijs

    Netherlands

    Code Simon put tapped off.  The Down button was a nice touch, but cannot be disabled so we were testing times preaction and the param 'Trial' could get pretty messy especially on a series of rehearsal

  • How to build a VI that generates a random number between 1 and 80... Help!

    Generate a VI that generates a random number between 1 and 80

    Divide the random number by a number specified in the front panel.

    If the number of seizures is zero, the VI program should light a LED in the face to indicate a divide by zero error.

    Hai edwardty2009,

    Welcome to the forum.

    Thanks for the congratulations.

    Your problem is solved? If so can you please mark as solution what post help better to solve your problem.

    Thank you

    Mathan

  • Wireless network problem: disconnects randomly anywhere between 1 and 4 hours.

    I have a wireless network problem, it disconnects randomly anywhere between 1 h and 4 h. The network consists of a Samsung 4 G hotspot and a Linksys AE1000. The signal strength is excellent, the AE1000 is 1 ft of the computer and 1 ft of the HotSpot.  The computer is a Dell Dimension 2400. Any ideas?

    Hi Jack,

    Problem solved.  I did 2 assumptions about the original problem.  I assumed that the 2 Tech that I spoke made the hurt their product. Battery saver has been activated on the hotspot.

    Thanks again

    Greg

  • Insertion of space between or moving along the timeline of the actions

    Can someone tell me how to insert a space between stocks or move actions in the timeline panel. I'm new on board, although I have some previous experience with Flash.

    I added a shortcut for it in the preferences.

    Otherwise, you must go to

    menu/timeline/insert time

  • a script of random generation of positioning within a specific area

    I'm creating a series of online festive banners that have a timeline controlled by AS2 (everything very basic - simple fade and go to the next section). I have from a random generation script to produce an effect of flicker on a stretch of the banner, but I wish that the sparks don't appear that in a specific area of the banner, but used _x, FLF, positioning of the controls do not seem to function as you can see below, I managed to limit, in that they appear but as I said is not the positioning of them.  My knowledge IS limited so I'am wrong - code for the random generator is below

    var numOfSparkles:Number = 10;

    var fadeAmount:Number;

    function attachSparkel() {}

    var t: MovieClip = _root.attachMovie ("sparkle", "sparkle" + _root.getNextHighestDepth (), _root.getNextHighestDepth ());

    t._x = Math.floor (Math.random () *(310-t._width));  / * area * /.

    t._y = Math.floor (Math.random () *(82-t._height));  / * area * /.

    t._xscale = t._yscale is Math.floor (Math.random () * 50) + 80.;

    t.fadeAmount = Math.ceil (Math.random () * 15); / * fade speed * /.

    t.onEnterFrame = function() {}

    This ._alpha = this.fadeAmount;

    If (this ._alpha < = 0) {}

    delete this.onEnterFrame;

    attachSparkel();

    }

    };

    }

    for (i = 0; i < numOfSparkles; i ++) {}

    attachSparkel();

    }

    If you must limit the spark of a more specific area then you must identify the minimum from value and the additional random value is added to the...

    var xmin = 0;

    var xmax = 310;

    var ymin = 0;

    var ymax = 82;

    t._x = xmin + Math.floor (Math.random () * (xmax - xmin - t._width));  / * area * /.

    t._y = ymin - Math.floor (Math.random () * (ymax - ymin - t._height));  / * area * /.

    The code just show will duplicate what you have already until you change the values of the min/max variables.

    [edited on behalf of 4th OK variable - is wrong to repeat "xmax"]

  • How to insert an image between an as3 textfield?

    Hi guys just a quick and easy for you guys

    I was wondering how to insert an image between a textfield as in

    mytext_txt. Text = "click on" + image + "for instructions.

    This kind of thing

    Thank you

    fonzio

    Set the focus:

    stage.focus = explan_mc.intro1_mc.inputname_txt;
    

    To record data on the user's computer, take a look at the SharedObject class. Take your time and read it. There are also examples to do you'll quickly.

    You will soon see that this is a pretty simple class yet very useful.

  • Can anyone tell how to insert a string between the two another string...?

    Can anyone tell how to insert a string between the two another string...?
    For example: String1 = 'ABC '.
    String2 = "XY".

    I want that the chain of output like "AXYBC".

    If you have the Position where you want to place your chain, this might work:

    SQL> r
      1  declare
      2    vStr1 varchar2(20) := '123456789';
      3    vStr2 varchar2(20) := 'aa';
      4    nInsertPos number := 3;
      5    vResult varchar2(20);
      6  begin
      7    vResult := substr(vStr1, 0, nInsertPos) || vStr2 || substr(vStr1, nInsertPos+1);
      8    dbms_output.put_line(vResult);
      9* end;
    123aa456789
    

    If you want to insert it after a special character, you can search for the position of your character with the help of instr

    concerning

  • I'm lost here.  I left a message in the discussions [4 years PS E7 problems developing -?] and he was moved to the "Forum elements.  I come here and there are about a dozen question back 4 hours and no sign of page numbers.  Not a total newbie to foru

    I'm lost here.  I left a message in the discussions [4 years PS E7 problems developing -?] and he was moved to the "Forum elements. Yes, I was wrong. I come here and there are about a dozen question back 4 hours and no sign of page numbers.  Not a total newbie to forums, but I'm lost.  8-)

    I searched "4 years PS E7 developing problems...» "and couldn't find even in Discussions and notifications that it has been moved.  I would have thought that a search would have led me on the Forum of items with notes as to how much, if any, had read it.  This is what I'm used to.  As I said, I'm lost.  Sorry if it should be obvious, and if I look like a whiner.

    Viewerx wrote:

    Oh, so it has been moved, but still listed in the Discussions?  You could say that.

    When a thread is moved, it will also appear in its place of origin for a short period in order to allow the original poster to find.

    I didn't know where it was posted.  I'm not a moderator and couldn't have moved it.  Only, I went to your profile and watched your activity:

  • newbie question. How to insert equal spaces between clips?

    Hi forum,

    I've not used After Effects for about 10 years and now I'm back with baby steps so be patient and gentle if I don't get quickly.

    I created a simple composition with a bunch of clips one after the other. They're all on different layers which I think is how it is supposed to be. I want to put a space of equal time between each clip and I want to make a transition between images and adjacent clips on this space.

    I've spaced the clips by dragging and gaps between them trying to be equal to the eye, but would like to know if there is a distribution function that makes it easier and better.

    You can adjust the overlap with layers in the sequence to a negative number or a positive number. I keep my calendar set to executives. Just follow this movie and you'll see how your layers in sequence. BTW, length of layer is not serious, but they must be arranged so that they start to the first frame of the timeline for the overlap be precise.

  • CS4: insert a break between the motion tweens

    Hello

    I use Flash since version 2 and find the switch for the frustrating new motion tweens.

    I've scoured the web, read the tutorials and many of them discuss getting an object from point a to b.

    I just want to move an object from left to right break (no problem) to 20 frames and then slide down.

    I can accomplish a few ways, but it seems much too cryptic steps involved. A solution is relatively easy to implement, but timeline visualization that results is really poor.

    Here are my steps

    1: place symbol on stage

    2: right click on the symbol > add the motion tween

    3: (flash creates for 30 frames tween and playhead moved to frame 30)

    4: I drag the symbol to the right

    5: I manually add a property keyframe to frame 30 via F6 (which kind of lock the instance where I want)

    6: I manually add another property keyframe to frame 50 (the symbol is in the same place, as it was at 30)

    7: I add a regular raster through F5 to 80 frame and drag the proceedings down

    First question is this the right way? Or should I have divided the animation?

    As I said, it works, but my only complaint is that when the symbol doesn't move (between 30 and 50 frames) these frames are always blue. There is no way to look at the timeline and to know exactly where the object is paused. Doing so the old way, this gap would contain gray regular frames and be very easily identifiable. I have been programmed to understand that regular gray frames contain an object that is not moving, blue frames with arrows have... easy motion.

    I am attaching a file that shows the animation I need with a classic Tween and has a layer showing the motion tween, I described above.

    If someone could add a layer to this file with a better method and provide some instructions that would be great!

    Thank you for your time and help

    So, the way you have below is a way to do it for you. You don't need to necessarily use F6, but indeed "lock" the instance (all properties) between these two points.

    Another way to do it (although which gives the same look of timeline), would be to insert a keyframe to the position in the frame of 30 and 50 frame. (Ctrl/Cmd + click, insert keyframe > position, or use the query editor). Which locks the position of these two points, and then you can continue the rest of the interpolation.

    And another way to do this (look same timeline) would be to interpolate however desired, extend the tween, then copy to frame 30 properties and properties of the dough to frame 50. This will insert some keyframes are 30 frame and glue them to frame 50. It is the best way to do it if you have more than one interpolated property. You do not get the inserted additional keyframes (F6), and do not remember what type of key frame to insert (as in the previous way).

    So if you want the appearance of the timeline to change, you can do this. You have the frame interpolation 1-30. Frame 31, F7 and then copy the instance to frame 30 and Ctrl + Shift + V to paste it in place in the frame of 31. Then the rest is roughly the same as with the classics - insert 50 frame images, press F6 to the 51 framework and create the new motion tween.

    We played with the idea of changing the color in the middle of a range of interpolation, but it really complicated me soon with expectations (taking into account is the same instance as opposed to multiple instances of an object, etc.) and what it should look like (several shorter areas, does make sense for the user, what of facilitates etc.), so it was put on hold for the moment. It is something that we are always looking for good, and I'll add your notes to the existing enhancement request.

  • strange question by inserting the data...

    Hi everone,

    I have a strange question. I'm not looking I do something wrong or is this a bug?
    I do a simple ' insert into table (select statement). Everything is ok... It's inclusion. But when I run the
    "select statement" separately (actual data I need to insert), I get different data inserted in the table.

    -> I have observed something else where there is a "case statement" in the selection m than the data in the table are spoil...

    EX:

    SELECT TRIM (member_span.member_nbr) member_nbr-> this one I see the correct data
    (
    CASE
    WHEN SUBSTR (member.member_nbr, 10, 2) = '00' THEN TRIM (member.member_nbr)
    Of OTHER SUBSTR (member.member_nbr, 1, 9). '00'
    END Subsciber_nbr),-> This data are spoil seeing incorrect data in the table...


    Database version:

    Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - 64bi
    PL/SQL Release 10.2.0.2.0 - Production
    "CORE 10.2.0.2.0 Production."
    AMT for HP - UX: release 10.2.0.2.0 - Production
    NLSRTL Version 10.2.0.2.0 - Production

    < b > "" "did exactly the same thing in a different database. I don't have any problems out there"" "I'm getting problem only with this database < /b >"

    Anyone know a bug related to this problem?
    INSERT
    INTO member_load(member_nbr,   subscriber,   ymdbirth,   security_group,   group_nbr,   network_id,   cob_date)
      (SELECT TRIM(member_span.member_nbr) member_nbr,
        (
       CASE
       WHEN SUBSTR(member.member_nbr,    10,    2) = '00' THEN TRIM(member.member_nbr)
       ELSE SUBSTR(member.member_nbr,    1,    9) || '00'
       END) subsciber_nbr,
        (
       CASE
       WHEN LENGTH(member.ymdbirth) = 8 THEN member.ymdbirth
       ELSE NULL
       END) dob,
        (
       CASE
       WHEN TRIM(member_span.group_nbr) IN('108076',    '108077',    '108078',    '108079',    '108080',    '108081') THEN 'E'
       WHEN TRIM(member_span.group_nbr) IN('107001') THEN 'M'
       WHEN TRIM(member_span.group_nbr) IN('107005') THEN 'J'
       ELSE 'A'
       END) security_grp,
         TRIM(member_span.group_nbr),
        (
       CASE
       WHEN TRIM(member_span.business_unit) = '01' THEN 'N' || TRIM(member_span.business_unit) || '-' || TRIM(member_span.prog_nbr)
       WHEN TRIM(member_span.business_unit) = '03' THEN 'N' || TRIM(member_span.business_unit) || '-' || TRIM(member_span.prog_nbr) || '-' || TRIM(member_span.carrier)
       ELSE NULL
       END) network_id,
    
        (
       CASE
       WHEN LENGTH(member.ymdverify) = 8 THEN member.ymdverify
       ELSE NULL
       END) cob_date
       FROM member_span @dblink,
         member @dblink
       WHERE member_span.ymdeff > 20090908
       AND member.member_nbr = member_span.member_nbr
       AND TRIM(void) IS
      NULL
       AND member_span.member_nbr NOT IN 
        (SELECT member_nbr
         FROM member_span @dblink
         WHERE(20090908 BETWEEN ymdeff
         AND ymdend)
         AND TRIM(void) IS
        NULL)
      )
    ;
    Please help me with this question...

    Marella Phani wrote:

    sven
    
    different NLS settings....
    How can i find the NLS setting on both the databases..
    can i query some metadata table to find that..
    

    Please let me know how to proceed

    Anurag...

    It is not the problem with my SQL (that I know of). It gives a correct output that I need when I simply run the SQL query.
    I just give a few examples of data (no real data).

    But when I run Insert in staging_table (select statement). I do not see the correct data in staging_table...

    Thanks for all the replies...

    You can check your NLS settings with

    select name, value, isdefault from v$parameter where name like 'nls%';
    

    or in sql * plus with

    SQL> show parameter nls
    
    NAME                                 TYPE        VALUE
    ------------------------------------ ----------- ------------------------------
    nls_calendar                         string
    nls_comp                             string
    nls_currency                         string
    nls_date_format                      string
    nls_date_language                    string
    nls_dual_currency                    string
    nls_iso_currency                     string
    nls_language                         string      AMERICAN
    nls_length_semantics                 string      BYTE
    nls_nchar_conv_excp                  string      FALSE
    nls_numeric_characters               string
    nls_sort                             string
    nls_territory                        string      AMERICA
    nls_time_format                      string
    nls_time_tz_format                   string
    nls_timestamp_format                 string
    nls_timestamp_tz_format              string
    SQL> 
    

    Please be careful, that my comment about to_char was that under the assumption that you have a column for the number. If the column is VARCHAR2, do not add an extra TO_CHAR around this column. He could not give problems, but is not necessary (I think it can give problems in 9i, but impossible to find a small example yet).

    An idea to find the source of your problem would be to change the NOT IN subquery. At least in a NOT EXISTS a subquery. Or even better find a way to access the remote tables only once instead of twice.

    not exist

    INSERT
    INTO member_load (member_nbr,   subscriber
    )
    (
      SELECT TRIM(ms.member_nbr) member_nbr,
        (
       CASE
       WHEN SUBSTR(ms.member_nbr,    10,    2) = '00' THEN TRIM(to_char(m.member_nbr))
       ELSE SUBSTR(to_char(ms.member_nbr),    1,    9) || '00'
       END) subsciber_nbr
       FROM member_span@dblink ms,
         member@dblink m
       WHERE ms.ymdeff > 20090908
       AND m.member_nbr = ms.member_nbr
       AND TRIM(ms.void) IS
      NULL
       AND NOT EXISTS
        (SELECT null
         FROM member_span@dblink ms1
         WHERE (20090908 BETWEEN ms1.ymdeff AND ms1.ymdend)
         AND TRIM(ms1.void) IS NULL
         AND ms.member_nbr = ms1.member_nbr)
    
    )
    ;
    

    Is ymdeff a number or a string? If it is a string, then change 20090908 in '20090908'. If it is a number then keep as it is.

  • Firefox randomly changes between fullscreen and windowed mode

    While I use Firefox mode window it will change randomly a fashion advertising full screen, it will change between these modes constantly. I tried to reset Firefox, but this has not solved the problem.
    The only way I managed to keep it from constantly change is by going in the Task Manager with ctrl + alt + delete.

    Do the same with other browsers?

    Now after looking around a bit, I think I've found some information. If you are experiencing a different problem from that let me know.
    Try this link. https://support.Mozilla.org/en-us/Que.../913975

  • How to insert the file between the records in the database file

    Hi, I'm working on the project in which I need reading / writing of .mdb file. I am able to write data to the file, but I am not able to write data between two records. It's that I have to insert a few lines of data between the records in the file.

    Can someone tell me how to do? I really stuck with this problem.

    vaibhav

    Thank you
    In fact it was the problem with version 8.5.
    When I installed 8.5.1 it solved.

Maybe you are looking for

  • How can I update the email address for iCloud?

    I have a MacBook Air 11 from 2011.  Operating system is OS X El Capitan. Today I changed my e-mail address and password for iCloud on my devices, but I can't seem to understand how to update the e-mail address on my computer.  I asks me to enter my p

  • y at - it a plug-in for nuance pdf reader?

    I stopped using Adobe Reader and started using the Nuance PDF Reader. It is much more effective and a much smaller footprint. My problem is that she will not embeddable pdf documents in a web page. Example, I am reading my messages from Verizon Wirel

  • Search Google in Safari is slow

    I'm running Safari 9.0.3 with El Capitan 10.11.3 on a new Macbook Pro retina 15 "and have a hard time looking for the Safari address bar. Probably 50 to 75% of the time when I type something in the search bar to search Google, search hangs for a very

  • Share to icloud for photos

    I bought icloud 50 GB of service. I have an iphone 6 plus with IOS 9 and have an ipad 4 with IOS 8.je 17 GB photos and want to reach my lap top (windows 10) from my iphone / ipad for the same photos. I have to upload a photo to see my iPhone 6 more v

  • Problems of bad video driver Y470P for Windows RDP

    Hello world I'm having a problem with the video driver ATI/Intel when remoting into my home computer. I use the windows remote RDP Protocol on my work computer and whenever I try to use java or flash, I get an error causing the my browser (this happe