logic of production of Minute

Hello

I have a table OMP. There are 3 columns... As

{Start end date date Qty
***********              *******************   ******
08/03/2011 20:21 09/03/2011 10:33 158}

{BUILDINGSTARTSHIFT BUILDINGSTARTTIME
*******************             ******************
201103092... second post 2021
201103093... third post 2200
201103091... first post 600}

There are 3 shift is there by day... first change from 06:00. second shift 14:00 third 10 p.m. shift.

1 consider since stardate to enddate OMPWORKORDER time of each shift

{BUILDINGSTARTSHIFT BUILDINGSTARTTIME NUMBER OF MINUTES THE ENDTIME
******************   *****************      *********          ******************
201103092 2021 21:59:59 98
201103093 2200 5:59:59 480
{201103091 600 10:33:00 153}

TOTAL = 731 MINS.

I have to subtract a second from buildingstarttime. Buildingstarttime is 600 then end time 05:59:59. If that's 2200 then endtime 21:59:59.

2. share the OMPWORKORDER. AMOUNT of each shift

Quantity / (endtime-startime) = 158/731 = 0.2161142271

3 divide the amount by Maj

Final output
**********

{BUILDINGSTARTSHIFT NUMBER OF MINUTES AMOUNT OF TIRES MINUTE BY MAJ}
{****************** **************** ****************** **************}

{201103092 98 21 0.216111423}
{201103093 480 0.216111423 104}
{201103091 153 0.216111423 33}

See, how logical is here...! Pleaaaaaaaasssssssssseeeeeee help me.

Concerning
Evelyne

Hello

Thanks for posting the CREATE TABLE and INSERT. The purpose of doing this is to allow people who want to help you recreate the problem and test their ideas. If you post something that doesn't work, as you did, then it defeats the purpose.
When you said

{create table OMP(WORKORDERID VARCHAR2(100) NOT MASTERPROCESSID VARCHAR2(100),  ...

did you mean

create table OMP
(   WORKORDERID      VARCHAR2 (100)    NOT NULL
,   MASTERPROCESSID VARCHAR2(100)
,  ...

? Do you want people to view responses that work? If so, make sure that the code of that validation works, too. Test it before uyou post.

I think that's what you want:

WITH     got_quantity_per_day     AS
(
     SELECT     startdate
     ,     enddate
     ,     quantity
     ,     quantity /(enddate - startdate)     AS quantity_per_day
     ,     3 * (enddate - startdate)     AS num_shifts
     FROM     omp
)
,     all_shifts     AS
(
     SELECT     first_shift_start + ( (LEVEL - 1)
                        / 3
                        )     AS shift_start
     ,     first_shift_start + ( LEVEL
                        / 3
                        )     AS next_shift_start
     FROM    (
               SELECT     TRUNC (startdate) + ( CASE
                                     WHEN  TO_CHAR (startdate, 'HH24:MI')  < '06:00'
                                     THEN  -2
                                     WHEN  TO_CHAR (startdate, 'HH24:MI')  < '14:00'
                                     THEN   6
                                     WHEN  TO_CHAR (startdate, 'HH24:MI')  < '22:00'
                                     THEN  14
                                     ELSE  22
                                          END
                                  / 24
                                  ) AS first_shift_start
               ,     num_shifts
               FROM    got_quantity_per_day
          )
     CONNECT BY     LEVEL <= 2 + num_shifts
)
,     got_actual_times     AS
(
     SELECT     q.quantity
     ,     q.quantity_per_day
     ,     a.shift_start
     ,     GREATEST (a.shift_start,      q.startdate)     AS actual_start_time
     ,     LEAST      (a.next_shift_start, q.enddate)     AS actual_end_time
     ,     CASE  TO_CHAR (a.shift_start, 'HH24:MI')
                  WHEN  '06:00'  THEN  '1'
                   WHEN  '14:00'  THEN  '2'
                                 ELSE  '3'
          END                              AS shift_Id
     FROM     got_quantity_per_day  q
     JOIN     all_shifts           a  ON   q.startdate  <  a.next_shift_start
                                AND  q.enddate        >= a.shift_start
)
SELECT       TO_CHAR (shift_start, 'YYYYMMDD') || shift_id          AS buildingstartshift
,             (actual_end_time - actual_start_time) * 24
                                     * 60          AS number_of_minutes
,       quantity_per_day / (24 * 60)                      AS quantity_by_minute
,       ROUND ( (actual_end_time - actual_start_time)
            * quantity_per_day
          )                              AS tires_by_shift
FROM       got_actual_times
;

The results aren't quite what you asked:

BUILDINGS NUMBER_OF_MINUTES QUANTITY_BY_MINUTE TIRES_BY_SHIFT
--------- ----------------- ------------------ --------------
201103082                99         .185446009             18
201103083               480         .185446009             89
201103091               273         .185446009             51

Please explain how you get the number_of_minutes column that you posted.

Tags: Database

Similar Questions

  • When to use real-time applies to logical expectations... !!

    Hi all

    I tried several ways to speed up archiving on primary and improve sql apply pending logical, but still we get 45-50 minutes late between the primary and the logic of sleep.

    We wanted to have our transactions applied logic waiting in couple minutes. I suppose that the habit is possible in asynchronous mode.

    That is why I intend to implement real-time applies between primary and logical intelligence.

    Now since our two databases are too far from each other (main is in the United States and makes sense in India) it is recommended to implement real-time applies in such situation? And if implemented it would affect primary DB Performance?

    As if there could be some coupling of network or primary packet loss will try again and keep logical DB in sync with primary?

    For any help or suggestions would be great.

    Thank you.

    Yes, apply in real time is recommended in your case.

    However, because of the geographical distance between the primary and standby; I would say to keep your watch in current - max performance mode; ASYNC-himself. It would not affect the performace of the primary.

    As long as you set the parameters of the FAL and configure tnsnames properly and ensure that the policy appropriate for cleaning archivelog primary (so), you should not find any problem with primary & ensures synchronization.

    Good luck.

    See you soon.

  • How to add additional sas drive to an existing IBM midsize V3700 and do like being active in all hosts with vcenter server devices

    Hello team,

    In our infra we have 8 node of the flex IBM x 240 and 1 IBM midsize V3700 host as storage device. In this 19 storage hard drives busy with 600 GB 10 k 6 GB SAS drive and 5 locations are still, that storage is divided into 2 for test and Production. Now we expect for resizing the activity so that we plan to add more 5 hdd storage, can someone guide me how do it properly without any problem.  If I add the HARD drive storage how to initialize and map to the existng storage. If someone has done this before please guide me to continue.uat.JPGPro.JPG

    What you have to do is create a new disk (mdisk) group and add to your existing (mdiskgrp), to make task record the following:

    1. click on internal disks and then bind o pools:

    2. click on configure storage:

    3. on the storage configuration wizard, you can select use recommended Configuration or select a Configuration different, but the most important is to select your existing disk group RAID level:

    4. then select the Expand existing Pool:

    Once the capacity of the new disk has been added to your existing pool, you can create new volumes to expand your existing volumes (LUNS UAT or logic of PRODUCTION unit number).

    Let me know if you need additional assistance.

  • LUN and storage Partitions

    When you use the IBM DS4700 SAN and if ESX supports only one active path to a logic unit at a time number - if I have a logic of Production and an another LUN of Test unit number, I'd rather create a partion of storage for each, then ask SAN CTRL A - & gt; path preferred on Production LUN SAN CTRL B - & gt; the path preferred to LUN of Test? the attached picture shows how I have two paths each HBA, FC switch and SAN. I would like to optimize traffice as much as possible. Any suggestions?

    Thank you

    Am I right assuming that I would be better for the performance of each logic unit on a separte storage partition number and each controller

    Altogether.

    For each RAID Group (or group of physical disks), only 1 LUN.

    At least 2 LUNS.

    If possible (if you have 4 way and many records) also consider using 4 LUNs.

    Rember that each logic unit number must be<>

    André

    * If you found this device or any other answer useful please consider awarding points for correct or helpful answers

  • difference b/w sqlldr &amp; tables outside

    Hello

    What is the major difference between sql loader and external tables? What is the best way to load data into tables?

    Please explain to me... !!

    concerning
    AK

    >
    I'm your devil of logic (shift/week/month/minute)
    >

    Yes. Yes. ;-)

    G.

  • Skip a level of table

    Hi, I have these 3 tables (right FKs and joins) in my Dimension product:

    CITY, SUPPLIER, PRODUCT.

    The right hierarchy should be high in leaves: City-> provider-> product

    We would like to build the hierarchy of these dimensions:

    City-> product, but we get this warning in BI Admin (and the error then in the answers)

    [39008] logical dimension CITY table has a source of the CITY who do not adhere to any source of fact.

    It cannot sail in joins, the level of the intermediate jump table?
    Are we obliged to build the whole hierarchy and spend level (and table) defining a privileged way of exploration? (this solution worked)

    Thanks in advance!

    To resolve this problem, you have two options.

    Don't forget that you have in the correct join FK relationships of physical layer between these tables as follows:

    City-<><>

    In the MDB do logical table (dimension table) with source logical table product. Now, in the source of the product logic table properties general tab add physical tables and joins (add first table beg and join product >-provider, and then add the picture of the city and join provider >-City). Now, drag - move the columns in all tables that you want to use in the levels in the dimension.

    Build the dimension with levels object and columns on each level.

    Option 1 (all three levels):

    The city level: use for drilldown checked key
    Provider level: use for the uncontrolled descent of key
    Product level: use for extraction of key checked or unchecked

    Now you can dig in the answers given by the city to the product, the intermediate level is not displayed, obiee do reach across the three tables.

    Option 2 (city and produced only in levels):

    The city level: use for drilldown checked key
    Product level: use for extraction of key checked or unchecked

    Now you can dig into the responses made by the city to the product, obiee do reach across the three tables, because you set this additional physical tables and joins in logical table product source.

    Concerning
    Goran
    http://108obiee.blogspot.com

  • Data Guard - recreate primary school

    Hi all!
    I have following question:
    We have the database of development which is often deleted and then recreated the production base. Now we implement logical queued for this base of development, where we will create a few additional items.
    What will happen when the primary database is deleted? It will be possible to "link" existing logical standby for newly created primary?
    Would it be possible or there is another solution? Creation of a database of most main role is the last option.

    Hello
    If I understand correctly, you have this scneario
    Dev DB > refresh from Prod per week or regularly.
    Logical standby created according to Dev DB.
    What happens to logical Standby Dev DB is updated.

    I think that it can continue to operate, but there may be logical inconsistencies.
    It would be safe to rebuild your database logic, if you want to use it for some other development tests.

    Not sure if the transportable tablespaces is an option for you.

    Get dev db data using transportable tablespaces or datapump. Make the changes on it; export changes or schema before refresh; Import it back after refresh to make additional changes on the new data.

    or
    Create an eve of logic of production instead of clone of dev and make your changes here to test the object.

    MSK.

  • Reset every 30 minutes after loading the product key valid evaluation license key.

    OPERATING SYSTEM.  Windows Embedded Standard 8

    By the intermediary of "slui 4" to enter the OEM product key, the product key is accepted.

    By 'System', the 'activate Windows' shows "Windows is activated", product ID: 00227-20010-00864-AAOEM.

    By "slmgr /ato" cmd error: 0x80072EE7 on a computer running Microsoft Windows non-core, run 'slui.exe 0x2a 0x80072ee7 to display the error text.

    Via "slui.exe 0x2a 0x80072ee7" cmd, it showed "You can also contact Microsoft by phone to help solve this problem" and the description showed "the server name or address could not be resolved."

    In addition, under the c:\Windows\debug\wlms.txt, it showed the following every 30 minutes.

    2015-11-05 15:03:27, info WLM Windows Embedded Licensing Monitoring Service starts.
    2015-11-05 15:03:27, info WLM entering ServiceMain.
    2015-11-05 15:03:27, the status of the service Info WLM Reporting 2
    2015-11-05 15:03:27, Service Info WLM Reporting as 4 State
    2015-11-05 15:03:30, info WLM license isn't an evaluation license.  EVAL in the image of production not supported.  It stops immediately.
    2015-11-05 15:18:33, WLM the license info is not an evaluation license.  EVAL in the image of production not supported.  It stops immediately.
    2015-11-05 15:33:35, info WLM license isn't an evaluation license.  EVAL in the image of production not supported.  This computer shuts down
    2015-11-05 15:33:36, WLM Service info received control message 5
    2015-11-05 15:33:36, Service Info WLM Reporting as 3 status
    2015-11-05 15:33:36, pulled out of WLM Info event.  Stopping service.
    2015-11-05 15:33:36, Service Info WLM Reporting 1 status
    2015-11-05 15:33:36, info WLM out ServiceMain.
    2015-11-05 15:33:36, info WLM Windows Embedded Licensing Monitoring Service is out.

    Help, please. Thank you.

    I believe that the error is to tell you that you can not migrate an eval version to a production version.  I suspect that you will have to wipe and install

    The license is not an evaluation license.  EVAL in the image of production not supported.  It stops immediately.

  • Due to a hardware problem, I had my logic board and replaced hard drive. How can I do to reactivate older versions of adobe products? (Acrobat, Illustrator and Photoshop)

    Due to a hardware problem, I had my logic board and replaced hard drive. How can I do to reactivate older versions of adobe products? (Acrobat, Illustrator and Photoshop)

    Old version download apps:

    CS 6:

    https://helpx.Adobe.com/x-productkb/policy-pricing/CS6-product-downloads.html

    On the same page, you will have the possibility to download other versions.

  • I bought Lightroom 5 9 December 2013 and want to download to my new computer.  I spent an hour chasing the download link.  It's funny, when I bought the product Adobe responded and took my money in 5 minutes. Now, I want my product and can not find a year

    I bought Lightroom 5 9 December 2013 and want to download to my new computer.  I spent an hour chasing the download link.  It's funny, when I bought the product Adobe responded and took my money in 5 minutes. Now, I want my product and can not find an answer.

    Have you tried these links

    Adobe - Lightroom: For Macintosh

    Adobe - Lightroom: For Windows

  • My windows chassis disappers after about a minute by all adobe products.

    I have CS3 and adobe XI player and my disappers of chassis of windows after about a minute. In my opion this problem starts by upgrading to adobe reader XI. Even if deinstalltion drive and all the problem adobe products persists. So please can someone help me?adobe without windows frame.png

    I wonder if you have Kapersky Antivirus?

  • Logical group - it is adjustable to the Product dimension?

    Hi expert,

    We currently use FDM on v.11.1.2.1 version and already have the definition of logic for the accounts dimension group. In addition, we would like to check if it is possible to set up groups of logic for the Product dimension too?

    Is what we want to achieve, to be able to do 1 source produces many products of destination. Is it possible to reach in MDF?

    Please kindly help!

    Thank you very much!

    You can do this, but will have to use a complex logical group (simple logical groups work on the dimension of accounts). This allows you to define the rules of Group on any active dimension. If you see the appropriate section in the Administrator's guide FDM this should give you a good base to start

  • What is the product of adobe 'better' and faster to do a 3 to 5 minutes of recording for a program creative meadows?

    What is the 'best' Adobe product to quickly create a 3 to 5 minutes presentation that is creative and very professional for the environment of higher education for a Committee?

    Hi Corrine,

    To do this, you can try Adobe Captivate or Adobe Presenter.

  • logic of weekly production

    Hi all

    I have two tables as owp and cure.

    OMP table whose columns ...mm/dd/yyyy hh:mi... Ormat

    Start end date date Qty mastermachineid
    ******** ******** **** **************
    03/07/2011 06:00 04/05/2011 06:00 5154 1010

    table of cure with columns

    FromDate to date mastermachineid
    ------------- --------- --------------------------
    03/06/2011 04:00 03/08/2011 11:30 1010

    Here, the data is saved on a weekly basis and the beginning of the week is always Monday. The day of the interface must also be < the start date of the week.

    Mastercalexception hours = 29.5

    EndDate-startdate = 696 hours
    EndDate-startdate-mastercalexception hours = 696-29, 5 = 666.5
    Quantity / endate-stardate)=5154/666.5=7.732933 (tires/hour

    We need calculate the number of hours available per week. Since last week, we have a single day, we take 24 hrs.

    Multiply and round number of hours of the week.
    By multiplying the number of hours with the amount, you get the total quantity.

    OUT put wants to like that
    **********************
    Starddate week the week Enddate hours in a week MasterlExc: Tot Qty / h Qty per wek

    03/07/2011 13/03/2011 168 29.5 138.5 7,732933 1071
    14/03/2011 20/03/2011 168 0 168 7,732933 1299
    21/03/2011-27/03/2011 168 0 168 7,732933 1299
    28-03-2011 3/4/2011 168 0 168 7,732933 1299
    4/4/2011 10/4/2011 24 0 24 7,732933 186

    I wrote up to a logic of measurement to get every Monday and Sundays and masterexc hrs. Please find below...

    remaining part... I need your help... I want to create a view for this logic... Please help me.

    Please find below my logic

    WITH M
    AS (SELECT TO_DATE (' 07/03/2011 06:00 ',' dd/mm/yyyy hh: mi: ss AM') start_date,)
    To_date (' 05/04/2011 06:00 ',' dd/mm/yyyy hh: mi: ss AM') end_date
    THE OMP)
    SELECT start_date_of_week
    FROM (SELECT TRUNC (start_date + (LEVEL - 1)) start_date_of_week)
    M
    CONNECTION OF LEVEL < = (end_date - start_date) + 1).
    WHERE TO_CHAR (start_date_of_week, "fmday") IN ('Monday');


    WITH S
    AS (SELECT TO_DATE (' 07/03/2011 06:00 ',' dd/mm/yyyy hh: mi: ss AM') start_date,)
    To_date (' 05/04/2011 06:00 ',' dd/mm/yyyy hh: mi: ss AM') end_date
    THE OMP)
    SELECT end_date_of_week
    FROM (SELECT TRUNC (start_date + (LEVEL - 1)) end_date_of_week)
    S
    CONNECTION OF LEVEL < = (end_date - start_date) + 1).
    WHERE TO_CHAR (end_date_of_week, "fmday") IN ('Sunday');

    masterexehrrs
    ***********
    Select (less (b.enddate, a.todate) - greatest (a.fromdate, b.startdate)) * 24 total_hrs of healing a, b omp
    where a.mastermachineid = b.mastermachineid;

    Concerning
    Evelyne




    Concerning
    Evelyne

    Hello

    Try the following,
    You can simplify this query a lot more.

    SQL> WITH RANGE
      2         AS (SELECT omp.mastermachineid,
      3                    omp.startdate + lvl-1 shift_st_dt,
      4                    omp.startdate + lvl AS shift_end_dt,
      5                   (LEAST ( omp.startdate + lvl, todate) - GREATEST ( fromdate, omp.startdate + lvl-1)) * 24 shut_dwn_time,
      6                    omp.qty quantity,(LEAST ( enddate, todate) - GREATEST ( fromdate, startdate)) * 24 total_hrs,
      7                    (enddate - startdate) * 24 avail,todate,fromdate
      8               FROM ompworkorder omp,(SELECT LEVEL lvl
      9                                      FROM (SELECT MAX (enddate - startdate) AS diff FROM ompworkorder)
     10                                    connect BY LEVEL <= (diff)),mastercalexception mcal
     11              WHERE omp.mastermachineid = mcal.mastermachineid
     12                AND lvl  <= (enddate - startdate) + 1
     13             ORDER BY shift_st_dt)
     14    SELECT DISTINCT mastermachineid,week_start,week_start+6 week_end,hours_in_week, masterexcl_hours,ROUND(qty,2) quantity,
     15           ROUND((hours_in_week- masterexcl_hours) * qty) total_qty_shift
     16      FROM (SELECT mastermachineid,
     17                   TRUNC (shift_st_dt,'IW') week_start,
     18                   SUM(24) OVER(PARTITION BY TRUNC (shift_st_dt,'IW')) hours_in_week,
     19                   SUM(DECODE (SIGN (shut_dwn_time), -1, 0, shut_dwn_time)) OVER (PARTITION BY TRUNC (shift_st_dt,'IW')) masterexcl_hours,
     20                   quantity / (avail - total_hrs) qty
     21              FROM RANGE A) ORDER BY week_start;
    
    MASTERMACHINEID WEEK_STAR WEEK_END  HOURS_IN_WEEK MASTEREXCL_HOURS   QUANTITY TOTAL_QTY_SHIFT
    --------------- --------- --------- ------------- ---------------- ---------- ---------------
               1010 07-MAR-11 13-MAR-11           168             29.5       7.73            1071
               1010 14-MAR-11 20-MAR-11           168                0       7.73            1299
               1010 21-MAR-11 27-MAR-11           168                0       7.73            1299
               1010 28-MAR-11 03-APR-11           168                0       7.73            1299
               1010 04-APR-11 10-APR-11            24                0       7.73             186
    
    SQL> 
    

    Franks approach for data per week directly would be much better. You can try that as well.
    I have not the time to break down as frank right now. Maybe later!

    G.

  • Why should I Windows 8 for the 30 minute increments in the parental control?

    As a developer of software using languages and platforms of Microsoft, I understand how planning works in an application. Why should I upgrade to Windows 8 to get the opportunity to restrict access timed to a PC safe family 30 minutes increments? This is no logic, except if it is half cooked to inform users to upgrade. This is a feature I've wanted since we began using the parental control and I can only assume the developers actually do not use the product, they have created because it really shouldn't been missed for this long. It should also be a simple change in the code to check every 30 minutes instead of 60. Maybe the team of parental controls overlap or had their budget reduced to the point that they cannot make such a simple plus change. I understand, I am in the software. I know it's less than constructive but it's annoying to know different. It's annoying to 'upgrade' to 2012 Essentials see virtually no difference in the features. Your users are not YOU!

    Hello

    Sorry for the inconvenience. You can send this as a feedback through this link on our product team to be aware of issues and suggestions from users of the products.

    Thank you.

Maybe you are looking for

  • iTunes and Windows 10

    I can't use, to upgrade, install, repair, or uninstall since upgrading my PC for Windows 10.  I've tried everything recommended here, Apple. Microsoft referred me to Apple. I tried to remove all Apple products that works with the exception of iTunes.

  • New hard drive. Do I need windows disk?

    I have a HP Pavilion dv7 laptop and recently the hard drive has failed... It was running windows 7 home basic 64-bit and did not come with recovery disks. im going to buy a new hard drive to replace soon and I was wondering what discs do I have to ge

  • 646 error code 2 update won't go through what should I do to fix this problem now?

    WHAT MUST I DO FOR CODE ERROR 646 UPDATE IS COMPLETE WHY EVERYTIME I TRY TO INSTALL UPDATE I STILL MEET 646 2 UPDATE ERROR CODE DOES NOT INSTALL IS THERE A VIRUS ON MY COMPUTER HOW CAN THIS PROBLEM BE FIX NOW

  • When I download the files with rar extension I can not open the file

    files with rar extension can be saved and found on my computer but I can't open them

  • Unable to join the domain "DNS name does not exist."

    Working on this computer remotely in my company, it has more a problem but at this moment, that we focus on trying to reach the area. We removed everything first to see if it would fix the trust relationship issues she felt the long side not being ab