Select the period 30 sec by random for each hour

Hello
Is it a good cool way to delay select 30 sec for each hh24, ideally that should be selected at random 30 sec for each hour.

for now I use it because I 1.24 LOOP and specific (non-random) selection interval.

Or in other words is there any random function that may generate number BUT in the predefined example limits (0 thru 3570) (3 600 s - 30 s)

SELECT...
WHERE INDATE WITH (D1 (D1 + 30/86400))

TX
T

Hello

TRUNC (dbms_random.value (0, 3570))

Returns a random integer between 0 and 3569.
So if dt is an Oracle DATE, indicating the beginning of time,

dt + ( dbms_random.value (0, 3570)
     / (24 * 60 * 60)
     )

will be the start of a period of 30 seconds which is entirely within this time, as shown in this query:

ALTER SESSION     SET NLS_DATE_FORMAT = 'HH24:MI:SS';

WITH     got_hrs     AS
(
     SELECT  TRUNC (SYSDATE) + ( (LEVEL - 1)
                            / 24
                      )     AS hr
     FROM    dual
     CONNECT BY     LEVEL <= 24
)
SELECT    hr
,       hr + ( TRUNC (dbms_random.value (0, 3570))
                             / (24 * 60 * 60)
                      )     AS period_start
FROM       got_hrs
ORDER BY  hr;

Typical power:

HR       PERIOD_S
-------- --------
00:00:00 00:36:35
01:00:00 01:21:00
02:00:00 02:12:55
...
21:00:00 21:19:24
22:00:00 22:54:55
23:00:00 23:04:59  

Dbms_random is an integrated package, but you do not have privileges to use it. Otherwise, log in as SYS and grant EXECUTE privileges to you or to the PUBLIC, or have your DBA to do.

Tags: Database

Similar Questions

  • Select the emp with a maximum salary for each hr.emp manager_id

    Hello
    Can someone help me to do this without doing any partitioning or analytical f:

    Select the emp with a maximum salary for each hr.emp manager_id.

    HR. EMPLOYEES Table Description: =.
    EMPLOYEE_ID
    FIRST NAME
    LAST_NAME
    HIRE_DATE
    JOB_ID
    SALARY
    COMMISSION_PCT
    MANAGER_ID
    DEPARTMENT_ID

    TX, all the guys
    Mario

    Hi, Mario,.

    Here's one way:

    SELECT       *
    FROM       hr.employees
    WHERE       (manager_id, salary) IN (
                                          SELECT    manager_id
                              ,               MAX (salary)
                              FROM     hr.employees
                              GROUP BY  manager_id
                                   )
    ;
    

    mario17 wrote: Hi,
    Can someone help me to do this without doing any partitioning or analytical f:

    Do you mean analytical functions?
    Why you don't want to use the analytical functions? Analytical functions, permitting the simpler, more robust and more effective to achieve these results, wouldn't you want that?

  • I look integrated in the block of the legend of slide show, a widget like "Accordion" for, with one click, or by the way with the mouse, open a new caption for each photo. I tried with 'Accordion' Muse, it does not work. I haven't tried to copy and paste,

    Issue.

    I look integrated in the block of the legend of slide show, a widget like "Accordion" for, with one click, or by the way with the mouse, open a new caption for each photo. I tried with 'Accordion' Muse, it does not work. I haven't tried to copy and paste, but no result. The widget disappear into the legend of block. disappear. Do you have a solution?

    Thank you

    Loïc

    Accordion Panel tabs should, with click and open the container.

    Please provide the url of the site where it does not, also if you can provide an example where we can see the exact action, then it would help us.

    Thank you

    Sanjit

  • I have 2 blogs on my site, I need to customize the layout of Blog Post details for each diff?

    I have 2 blogs on my site, I need to customize the layout of Blog Post details for each diff?

    Hello

    Unfortunately, it is not possible to have multiple layouts of details for your blog by site, at this point.

    Kind regards

    -Sidney

  • get the IOPS / s and flow rate for each card of vmhba

    Hi, I have seen a few difficulties for the IOPS / s and flow stat for esxi for each vmhba card get the average, max, min

    I can get some network like net.usage.average, net.received.average and net.transmitted.average parameters as the metric is consolidated for all the network card.

    Here is the part of the classic script I use

    $metrics = "net.received.average", "net.transmitted.average".

    Get-Stat - entity $esx - start $start - finishing $stop - MaxSamples 10000 - Intervalmin 30 - stat $metrics |

    Group-object - property {$_.} @entity.name} | %{

    $esxname = $_. Group [0]. @entity.name

    $hard = (get-VMhost-name $esxname) .extensiondata. Summary.Hardware

    $netreceived = $_. Group | where {$_.} MetricId - eq "net.received.average" - and $_. {Instance - eq ""} | Measure-object-property value - average - Maximum - Minimum

    $nettransmit = $_. Group | where {$_.} MetricId - eq "net.transmitted.average" - and $_. {Instance - eq ""} | Measure-object-property value - average - Maximum - Minimum

    and so now, but on the storage card, consolidated metrics do not exist...

    Thank you very much!

    Try something like this

    $esx = Get-VMHost MyEsx$stat = "storageAdapter.numberReadAveraged.average","storageAdapter.numberWriteAveraged.average"$start = (Get-Date).AddMinutes(-5)
    
    Get-Stat -Entity $esx -Stat $stat -Start $start |Group-Object -Property Instance,Timestamp | %{$_ |Select @{N="Timestamp";E={$_.Values[1]}},@{N="Instance";E={$_.Values[0]}},@{N="Read IOPS";E={$_.Group | where {$_.MetricId -eq "storageAdapter.numberReadAveraged.average"} | %{$_.Value/$_.IntervalSecs}}},@{N="Write IOPS";E={$_.Group | where {$_.MetricId -eq "storageAdapter.numberWriteAveraged.average"} | %{$_.Value/$_.IntervalSecs}}}}
    

    It uses more or less the same concept that I used in my post to get the OPS are / s maximum .

  • I've updated the plug ins and it worked for 3 hours. What now?

    I was unable to watch the videos on my laptop. I have windows. I clicked on update my plugins and it worked for 3 hours. I even disconnected and then when I restarted the "keep your firefox healthy" right page went up and update plugins is still 'twirling '. Help

    in general only versions out-of-date Flash need to be activated, please install the update through https://www.mozilla.org/plugincheck/

    If you have problems with this, try the offline installers offered by adobe to https://www.adobe.com/products/flashplayer/distribution3.html instead (for firefox download & install the exe windows for "browser plugin").

  • People who consult a shared album in iCloud cannot see the detailed description that I entered for each photo.  Is it possible to solve?

    I created an album shared in iCloud and populated with photos after I had entered to be detailed for each of them.  My guests of the shared album can't see data description.  I can see it only when I use the Photos on a Mac app and do not see it if I use an iPad or an iPhone.  Am I missing something?

    My guests of the shared album can't see data description.  I can see it only when I use the Photos on a Mac app and do not see it if I use an iPad or an iPhone.  Am I missing something?

    No, unfortunately not - it is impossible to share the descriptions and titles.

    Metadata (descriptions, titles, locations, faces) will be removed from your photos when share you them in a shared album.

    If you want your friends to be able to see a legend, add a comment when you share pictures.

  • change the shade and use those unique for each site

    I'm not a big user of Illustrator so am not comfortable with the nuances yet. In Muse, I want to have a unique swatch panel for each Web site. How can I remove unused colors (I know how to add new ones) and then attach this unique sample for this unique site?

    Right-click on any color

    Click on 'delete unused nuances '.

    You cannot delete black or white. If a color is which is in the background, as the error message red in a contact form, then it won't let you remove used red unless you change the color of the error message.

  • Select the year max and max date for a code

    Hello

    I need to extract max year and month max for one code particulare.

    My table contains:

    YEAR MONTH CODE

    ====   =====    ====

    2014 6 X

    2014 7 X

    2013 5 Y

    2013 6 Y


    I need to extract:


    2014 7 X

    2013 6 Y


    I don't like max(YEAR|| le mois), I want the column separated.


    Thank you

    Try this:

    WITH test_data AS (
      SELECT 2014 AS yr, 6 AS mth, 'X' AS code FROM DUAL
      UNION ALL
      SELECT 2014 AS yr, 7 AS mth, 'X' AS code FROM DUAL
      UNION ALL
      SELECT 2013 AS yr, 5 AS mth, 'Y' AS code FROM DUAL
      UNION ALL
      SELECT 2013 AS yr, 6 AS mth, 'Y' AS code FROM DUAL
    )
    SELECT yr
         , MAX(mth) KEEP (DENSE_RANK FIRST ORDER BY 100*yr+mth DESC) AS mth
         , MAX(code) KEEP (DENSE_RANK FIRST ORDER BY 100*yr+mth DESC) AS code
    FROM   test_data
    GROUP BY yr
    ORDER BY 1;
    

    Obviously by storing your dates as the DATE, then ranked by who would be more elegant!

  • by selecting the frequency checks in your phone for email

    I wish I could choose how often my phone search e-mail so I can save my battery.  Right now I think he's still in search mode which should use a lot of battery.

    Take the call and scan from left to right the same with text messages and press down to select and delete them all!

  • the list widget with different colors for each item in the list?

    I'll add a widget list to my interactive color wheel:

    * http://r0k.us/graphics/SIHwheel.html

    It is an old applet, first published in 1998 and older than Swing.

    The list contains the names of color 1 567 which he knows the color values. I want the background color to each element to be one of the named color. The forefront color name text will be white or black, chosen for readability to her background. Basically, I'm hoping to accomplish what the name of this color page did with its list widget HTML-form:

    * http://chir.ag/projects/name-that-color/

    I studied the java.awt.list document:

    * http://download.oracle.com/javase/1.4.2/docs/api/java/awt/List.html

    SetBackground() and setForeground() methods are implemented, but they seem to apply only to the list as a whole. As far as I know, it seems there is no access to list items themselves as components. I hope that I am just missing what is obvious.

    -Rich

    What you want to do can be easily implemented on a JList swing, with the help of a custom converter. I would advise therefore to rewrite your applet in the swing, then use a JList. That way you can skip JUnit is studying just to force your applet awt to do something of awt was neither designed for and focus on swing of things GUI. Below is an example of how you can implement your JList:

    import java.awt.*;
    import java.math.BigInteger;
    import java.util.Arrays;
    import java.util.Comparator;
    
    import javax.swing.*;
    import javax.swing.event.ListSelectionEvent;
    import javax.swing.event.ListSelectionListener;
    
    public class ColorList {
    
        public static void main(String[] args) {
         SwingUtilities.invokeLater(new Runnable() {
    
             @Override
             public void run() {
              new ColorList().createGUI();
             }
         });
        }
    
        private void createGUI() {
         String[][] array = getArray();
         // sort the array as you wish
         Arrays.sort(array, new Comparator() {
    
             @Override
             public int compare(String[] o1, String[] o2) {
              return o1[1].compareTo(o2[1]);
             }
    
         });
         // create the JList
         final JList list = new JList(array);
         // set some adequate renderer
         list.setCellRenderer(new DefaultListCellRenderer() {
             private static final long serialVersionUID = 1L;
    
             @Override
             public Component getListCellRendererComponent(JList list,
                  Object value, int index, boolean isSelected,
                  boolean cellHasFocus) {
              DefaultListCellRenderer renderer = (DefaultListCellRenderer) super
                   .getListCellRendererComponent(list, value, index,
                        isSelected, cellHasFocus);
              renderer.setText(((String[]) value)[1]);
              int color = new BigInteger(((String[]) value)[0], 16)
                   .intValue();
              renderer.setBackground(new Color(color));
              renderer.setForeground(new Color(0xFFFFFFFF ^ color));
              return renderer;
             }
         });
         final JLabel demoLabel = new JLabel(
              "Display this text in the selected color", JLabel.CENTER);
         list.addListSelectionListener(new ListSelectionListener() {
    
             @Override
             public void valueChanged(ListSelectionEvent e) {
              String[] selected = (String[]) list.getSelectedValue();
              demoLabel.setForeground(new Color(new BigInteger(selected[0],
                   16).intValue()));
             }
         });
    
         JFrame frame = new JFrame("ColorList");
         frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
         frame.add(new JScrollPane(list), BorderLayout.LINE_START);
         frame.add(demoLabel, BorderLayout.CENTER);
         frame.pack();
         frame.setLocationRelativeTo(null);
         frame.setVisible(true);
        }
    
        private String[][] getArray() {
         return new String[][] {
    
         { "000000", "Black" },
    
         { "000080", "Navy Blue" },
    
         { "0000C8", "Dark Blue" },
    
         { "0000FF", "Blue" },
    
         { "000741", "Stratos" },
    
         { "00FF00", "Green" },
    
         { "FF0000", "Red" },
    
         { "FFFFF0", "Ivory" },
    
         { "FFFFFF", "White" }
    
         };
    
        }
    
    }
    

    Piet

  • How do you get the screen message appears only one for each case?

    Hi friends,

    I'm here with another question...

    I built a VI that must contain 6 boxes, when a particular check box is selected by the user, it should display a message to the user that the checkbox is enabled.

    My problem is: when I select one of the boxes the on-screen message continuously one after the other, even when you press the OK button.

    Can someone help me please?

    An option button allows only a boolean in it to be active at a time.  You see these things all the time.  Think about a survey that only lets you select one option.

  • "Windows cannot access the specified device, path or file" for each X 86 application on a Windows 2003 x 64 server

    Hello

    I have a Windows 2003 X 64 server and since a week ago everything works fine.

    For a week or two when I try to run an X 86 application, I always get this error:
    "Windows cannot access the specified device, path or file.
    If I run a x 64 apps everything works fine.
    What made a mistake?
    Thank you

    Hello

    Your question is more complex than what is generally answered in the Microsoft Answers forums. It is better suited for Windows Server on TechNet. Please post your question in the TechNet forums. You can follow the link to your question:

    http://social.technet.Microsoft.com/forums/en/category/WindowsServer/

  • How to force the jad file to be regenerated for each version

    I use Eclipse with the BlackBerry plugin.  Whenever I build the project active BlackBerry (Alt + B), it seems that Eclipse rewrites the file jad (the timestamp on the changes to the file), but the contents of the jad file is not re-written!

    I use the version string in the BlackBerry project properties to contain the version of my program.   But I find that even if I change the version string in the Properties window (and I can verify that the value has changed by looking in the file jdp), when I build the active project of BlackBerry, the MIDlet-Version string in the jad file does not change.  Yet if I delete the jad file and rebuild the project BB, then the jad file is written with the correct version string.

    It would be really nice if the build has successfully written the jad file, but short, how can I automatically have the deleted jad file?  As a matter of procedure, I usually do a project to clean and build together, before you build the active project BB.  Is it possible to change the Eclipse-specific procedure to remove the old jad file?  Is there a solution other/better?

    In addition, RIM - the fact that you do not write correctly the version string for the jad is a BUG!

    Thanks for the reply, but no, this link was not helpful.  There is no what I already know and have already said, with one exception - the problem, they talked was in the JDE and they suggested using the plugin - BAD NEWS - the plugin has the same BUG.

    What I did to make it work, it is write a cmd file that removes the jad and a few other files and set the absolute path to the cmd in the field of pre-build of project properties.   NOTE that the commands of the del in the cmd file must all also the absolute path.  I tried initially have an order of cd's as the first line of the cmd file, but that has not changed the directory - all the following commands continued to be run from the directory where the file of jdw.  I also tried put an led with an absolute path command in the field of pre-build directly (rather than using a cmd file).  Any work the del command.

  • do not come in my apps on cloud creative there just the icon to say his charge for 30 hours

    I purchased a plan for a year, I paid for this and its not coming in my apps on creative cloud, it's just a icon to say his charge its been done for atlas 30 hours now?

    Please check:

    Cannot install creative cloud office

    Solve the problems of downloading and installation of Adobe Creative Cloud

    Error download or update Adobe Creative Cloud applications

    Concerning

    Stéphane

Maybe you are looking for

  • Is there anyway for Firfox 29 unmetrouifiy?

    I never run Windows 8 because of the user interface,Now that Firefox was made to look like a Windows 8...I want to know if there is anyway to change UI back to what had 28 Firefox?

  • The Stop button does not appear except when I am customization settings

    I just upgraded to FF 3.6 to 8 FF. The button Stop (X) does not appear between the buttons reload and home. However, if I click with the right button on the menu bar and select Customize..., the X appears as it should be, then disappears again when I

  • Satellite Z930 - USB driver missing

    Satellite Z930-13N USB driver type by Intel xHCI shows the following error message: "This device does not work properly because Windows cannot load the drivers required for this device. (Code 31) » Anyone can shed some light on it with a solution? I

  • Sound does not work on Satellite A300

    I have a Toshiba Satellite A300 Windows Vista. The noise stopped working. I reinstalled the operating system and reinstalled the audio device on the site of Toshiba download drivers but I still get the error. "No Audio device detected". Under the win

  • Laptop: Windows 8.1 restoration/activation OEM

    I bought a new laptop bit 8.1 64.  It upgraded to windows 10 and active properly. I wanted to give 8.1 on it, but recovery options were not working, they said the files were not directly since my backup on 8.1 wim or there are missing files. I have n