Calculate the use of operating rooms

I received this question in an e-mail.

I will post it here, as well as my own answer-, so that other people with the same problem can find and learn, and that responses can be given (here there are smart people who might have alternative solutions of large .)

Here's the post with the question:

------------------------------------------

Hi Kim,

I'm stuck in a SQL query.

I want to calculate the use of operating rooms. follwing is my data structure

create the table room_usage
(in_time DATE,
out_time DATE,
mr_no VARCHAR2 (15).
room_no, NUMBER (3));

insert into room_usage
values
(to_date('11-Feb-15 8:33:00 AM', 'dd-mon-rr hh:mi:ss am'),
to_date('11-Feb-15 10:17:00 AM', 'dd-mon-RR hh:mi:SS am'),
'00052740',
733);
insert into room_usage
values
(to_date('11-Feb-15 10:56:00 AM', 'dd-mon-rr hh:mi:ss am'),
to_date('11-Feb-15 12:36:00', 'dd-mon-RR hh:mi:SS am'),
'00111780',
733);
insert into room_usage
values
(to_date('11-Feb-15 12:56:00 PM', 'dd-mon-rr hh:mi:ss am'),
to_date('11-Feb-15 2:46:00 PM', 'dd-mon-RR hh:mi:SS am'),
'00111777',
733);
insert into room_usage
values
(to_date('11-Feb-15 3:02:00 PM', 'dd-mon-rr hh:mi:ss am'),
to_date('11-Feb-15 6:12:00 PM', 'dd-mon-RR hh:mi:SS am'),
'00052713',
733);
insert into room_usage
values
(to_date('11-Feb-15 6:51:00 PM', 'dd-mon-rr hh:mi:ss am'),
to_date('11-Feb-15 7:57:00 PM', 'dd-mon-RR hh:mi:SS am'),
'00052760',
733);
insert into room_usage
values
(to_date('12-Feb-15 8:51:00 PM', 'dd-mon-rr hh:mi:ss am'),
to_date('12-Feb-15 9:57:00 PM', 'dd-mon-RR hh:mi:SS am'),
'00082760',
733);

Select IN_TIME, OUT_TIME, (OUT_TIME - IN_TIME) * 24 * 60 stay, MR_NO, ROOM_NO
of room_usage
When trunc (IN_TIME) between February 11, 15 'and 12 February 15'
order of in_time


in_time out_time stay_min mr_no room_no

11 February 15 08:33 11 February 15 10:17 104 00052740 733
11 February 15 10:56 11 February 15 12:36 100 00111780 733
11 February 15 12:56 11 February 15 14:46 110 00111777 733
11 February 15 15:02 11 February 15 18:12 190 00052713 733
11 February 15 18:51 11 February 15 19:57 00052760 733
12 February 15 20:51 12 February 15 21:57 00082760 733

But I also want to get time slots to USE NOT. This is the result I want

in_time out_time stay_min mr_no room_no

11 February 15 12:01:00 AM February 11, 15 08:32 511 no use of 733
11 February 15 08:33 11 February 15 10:17 104 00052740 733
11 February 15 10:18 11 February 15 10:55 37 no use of 733
11 February 15 10:56 11 February 15 12:36 100 00111780 733
11 February 15 12:37 February 11, 15 12:55 18 no use of 733
11 February 15 12:56 11 February 15 14:46 110 00111777 733
11 February 15 14:47 11 February 15 15:01 14 no use of 733
11 February 15 15:02 11 February 15 18:12 190 00052713 733
11 February 15 18:13 February 11, 15 18:50 37 no use of 733
11 February 15 18:51 11 February 15 19:57 00052760 733
11 February 15 19:58 11 February 15 23:59 241 no use of 733

How can I get that.

A problem like this is easy to solve with the model clause:

Select in_time, out_time, round ((out_time-in_time) * 24 * 60) stay_min, mr_no, room_no
of room_usage
model
partition (room_no, trunc (in_time) d)
dimension (row_number() on rn (partition room_no, trunc (in_time) order of in_time))
measures (in_time, out_time, mr_no)
rules iterate (1000) until (presentv (in_time [iteration_number + 1], 1, 2) = 2)
(in_time [iteration_number + 0.5] = presentv (out_time [iteration_number], [iteration_number] out_time, trunc (in_time [iteration_number + 1])) + interval minute '1'
, out_time [iteration_number + 0.5] = presentv (in_time [iteration_number + 1], in_time [iteration_number + 1], trunc (out_time [iteration_number] + 1))-'1' minute of interval
, mr_no [iteration_number + 0.5] = 'no use '.
)
order of in_time

Tags: Database

Similar Questions

  • How to calculate the use of the memory of the objects in Oracle/Collections

    Hi all
    Our application uses a large hierarchical object to store customer information and dependents. I am looking to display the amount of memory used to contain all the embedded objects and collections when filled with data.

    Please advice!

    Thank you

    PL/SQL collections are stored in the PGA. For example, you can monitor the use of the PGA of the meeting (s) to see how much PGA they use.

    SELECT sid, name, value
      FROM v$statname name
           JOIN v$sesstat using (statistic#)
     WHERE name.name in ('session pga memory', 'session pga memory max' )
    

    This will show, for each session, the current PGA consumed by the session and the high tide of the consumption of the PGA by this session. You can join V$ SESSION and add additional predicates to narrow things down to specific sessions you are interested in.

    Justin

  • How to calculate the total memory used by oracle under Linux?

    Hi all

    In one of my server have 148 GB of total physical memory and 12 databases are running. For capacity planning, I need to know how the Oracle server use.

    How to calculate the use oracle database? I was perplexed because Yop out his show off 148 gb 128 GB are used.

    Below for your reference:
    ++++++++++++++++++++
    == > back to top
    top - 09:52:32 up to 151 days, 15:20, 3 users, load average: 6.11, 6.00 6.05
    Tasks: 7 running, 1314, 1321 total sleep, stopped 0, 0 zombie
    CPU: 37.8%us, 1.4%sy, 0.0%ni, 55.0%id, 5.6%wa, 0.1%hi, 0.2%si, 0.0%st
    MEM: 148290444 k total, 129368792 k used, 18921652 k free, 1450292 k buffers
    Swap: 50331632 k total, 1296188 k used, 49035444 k free, 114733336 k cached


    The memory allocated to each instance is: sga total == > 34 pga = > 48 GB gb
    +++++++++++++++++++++++++++++

    SGA PGA
    4 GB 4 gb
    4 GB 4 gb
    2 GB, 4 GB
    2 GB, 4 GB
    2 GB, 4 GB
    2 GB, 4 GB
    2 GB, 4 GB
    3 gb 4 gb
    3 gb 4 gb
    4 GB 4 gb
    3 gb 4 gb
    3 gb 4 gb

    Thank you

    Try this - http://www.pythian.com/news/29703/oracle-instance-memory-usage/ for each of your instances.

    As far as I know, different instances may share only the binary code oracle and using libraries, so you should be able to easily understand the amount of memory of all instances of 12.

    Lordane Iotzov
    http://iiotzov.WordPress.com/

  • Is there a way to dynamically calculate the values for the IN operator?

    I want to know if there is a way to dynamically calculate the criteria to include within an IN operator in the WHERE clause. "For example when I try to run the following I get an Oracle error message ' OR!-01722: invalid number." The script below is just an example to help illistrate the problem, I don't want to hardcode the values assigned to the v_test directly within the IN operator because the values of v_test will change from user to user.

    DECLARE

    v_test VARCHAR2 (10): = '1,15,25,55';
    v_tmp VARCHAR2 (50): = NULL;

    BEGIN
    SELECT d.metric_title IN the tbl_health_metric_definition v_tmp d
    WHERE d.metric_status = 'Active' AND d.metric_id IN (v_test);
    END;

    You can convert the string "1,15,25,55" online like this

    SQL> select regexp_substr('1,15,25,55' ,'[^,]+', 1, level) list
      2    from dual
      3  connect by level <= NVL( LENGTH( REGEXP_REPLACE( '1,15,25,55' , '[^,]+', NULL ) ), 0 ) + 1
      4  /
    
    LIST
    ----------
    1
    15
    25
    55
    

    and use this selection in your IN clause.

  • How to calculate the equation of dataset using 'Fitting VI' (non-linear or polynomial fit)?

    I have the datasheet of a NTC (thermistor negative Coefficient) and I want to calculate the most approximate equation

    that describes its behavior. The table has values of temperature and resistance. If the resistance of the NTC varies according to the temperature it detects. I tried the following:

    -Excel: polynomial adjustment

    -Maple: polynomial adjustment

    -LabVIEW: Polynomial Fit.vi

    I've been doing equations with a not very good approximate parameteres. I suspect that this method 'Polynomial FIT' it is not the best method for this type of data/equation (being a non-linear equation).

    So is - that someone has used the non-linear Fit.vi matching the behavior of a dataset object? If so, can you explain how this VI... I would really appreciate it.

    Thanks in advance and I will wait for your reply.


  • Calculate the speed of the target by using photoelectric sensors 2

    I use 2 photoelectric sensors mounted parallel to each other. As the target passes in front of the sensor, the signal of output voltage goes from 0V to 10V. Because I know that the distance between the sensors, I need to use the difference of rise time of the signal between the sensors to calculate speeds. I can do that when I export the data to excel, but I would do it automatically into my LabVIEW code.

    The data of my sensors are the type of waveform. I can extract the waveform (t0, dt, Y) components using 'Get waveform components' and then look for the timestamp for each value using t0, dt and index value. I need to calculate the timestamp of each sensor once the signal passes to 10V (Y = 10V). I can't extract the components of waveform for signals from sensors (seems to only be able to extract the components for a sensor) and once I extracted components, setting up my calculation of the speed. I think I need a case structure to save the timestamp, once the signal hits first 10V (if Y = 10V save timestamp; if Y = 0V continue indexing of values).

    Any suggestions on the extraction of components of form of wave or indexation of values and calculation speed are greatly appreciated! The code I wrote to collect signals is attached.

    Thank you very much

    Alberto M.

    Here is a sample of the signals of the sensor showing the difference of signal rise time.

    1. you must use the finished sample mode and read all samples.  To match what you have, I would use 10 k samples.  That would be 5 seconds worth of data.  This eliminates the need for the while loop and gives you the full waveforms.

    2. just use the base trigger level detection VI (in the Signal Processing-> measures of waveform-> palette of Waveform Monitoring) to get the time for every rising edge.  Then it's a simple subtraction and divide.

    In addition, if you want to make things even easier, you could have used a camera with a meter of A - B.  Then the meter gives you just the time difference directly.

  • Calculate the maximum value of the sub-table when creating using a structure of case and records the shift

    I have two 1 d arrays that contain cyclical information (a bit like a sine wave).  One that contains information about the position in degrees and another that contains the couple.  I would like to calculate the value of maximum torque whenever the station is within a certain range (for example, 30 to 80 degrees).  The beaches are repeated - that is why it is cyclical.   I use the function "in the range", a structure of the case and the shift records to build a new table with the values that are included in the beach I said - that was easy part (see attached VI).  I'm struggling with a way to calculate a maximum value for each sub-table formed when the values are 'in range '.   Your help is very appreciated.

    vt92 solution worked!  I agree that there should be a simpler solution, but your to works fine.  Thank you very much.

  • How to test the stability of the communication and to calculate ber using the CVI?

    Our Chief Engineer gave me a task yesterday. He asked me to make testing of software and to calculate the error rate binary we would like to know our stability of communication.

    However, I never touched this aspect of knowledge. I know a bit about the CVI and I want to write code with CVI bit error rate. So I could test the stability of the communication.

    But I don't know how to analyze and judge the receivers codes, whether they are good or bad.

    We use the Modbus communication protocol and receive data via a port series, so I want to back up all the data and record the total number of datas, marking as M.

    then, save the eligible data and save the number marking as N. Thus, the error rate is binary/m (M - N).

    If it's doable? Or you have a good idea. Thank you very much.

    unsigned char in_data[100]; 
    
     inqlen = GetInQLen (comport);
     for(i=0;i
    

    Above is my code that receives all the data I want to save the data [] array in_data and save the number.

    switch(inqlen)
    {
     case 19:
     {
       crc=usMBCRC16(in_data,inqlen );
       if((in_data[1] == 0x03)&&(crc==0)&&(in_data[0]==device_addr))
        {
    
        }
     }
    

    Above is the judgment of condition who receive eligible data which mark as N number.

    I know there is a prerequisite that I filter all the bad data. However, I don't know any good idea. I'd appreciate if someone could help me.

    Thank you very much.

    Best regards.

    xiepei


  • What is hp psc 1355 all-in-one printer scanner copier compatible to be used in the WINDOWS XP operating system?

    I have a hp type copier printer scanner hp 1355. I need a driver (software) for this.  If the HP all-in-one device is not suitable for use on WINDOWS XP, is it possible to use hp 1355 in the WINDOWS XP operating system? Thanks FOR YOUR HELP.

    Hey Fed-Up-with-HP,

    Try using the brush included in the CD or download. Let me know what you find?

    Of the Original installation CD:

    1. Insert the CD in the drive and then cancel Setup

    2. open my computer and click right then on the CD from the drive and select open

    3 open the Util folder

    4 open the CCC folder

    5. run the uninstall_L4 (exe or Bat)

    6. once the uninstall is complete, restart the computer

    7 run the Accessories\ System Tools Disk Cleanup

    8. download and install the latest version of Adobe flash player

    http://www.Adobe.com/support/flashplayer/downloads.html

    9 download drivers and full software features

    http://h10025.www1.HP.com/ewfrf/WC/softwareDownloadIndex?softwareitem=MP-23606-3&cc=US&DLC=en&LC=en&os=228&Product=306898&sw_lang=

    10. run the download to reinstall the printer

    If the software has been downloaded and extracted to your system:

    1. type % temp % in the field of race

    2. Locate and open the folder starting with 7z (example: 7zS2356)

    3 open the Util folder

    4 open the CCC folder

    5. run the uninstall_L4 (exe or Bat)

    6. once the uninstall is complete, restart the computer

    7 run the Accessories\ System Tools Disk Cleanup

    8. download and install the latest version of Adobe flash player

    http://www.Adobe.com/support/flashplayer/downloads.html

    9 download drivers and full software features

    http://h10025.www1.HP.com/ewfrf/WC/softwareDownloadIndex?softwareitem=MP-23606-3&cc=US&DLC=en&LC=en&os=228&Product=306898&sw_lang=

    10. run the download to reinstall the printer

  • How to use between operator in Disqualification without using the script processor?

    Hello Experts,

    How to use between operator in Disqualification? for example phonenumberLength between 7 and 10. I don't want to use the script processor? Also how to reproduce the SWITCH statement Disqualification CASE?

    Thank you

    Konate

    1 Add a processor 'check the length.

    2. connect the transformer and open the configuration dialog box

    3. in the tab 'Attributes' select your attribute of telephone number as the "field Check.

    4. in the tab "Options", enter "7-15"in the option 'number of valid characters.

    5. run the process.

    a. accounts with [included] a character length 7-15 phone numbers out of the release of "valid".

    b. records with a length of character <7 or="">15 phone numbers out of the release of "Invalid character count.

    Note: the processor also adds a 'LengthValid' flag attribute which you may also branch on [with the values "Y" and "NC" for both scenarios above]. See Library of processor of the online help for more information.

    Thank you

    Nick

  • Is it possible to use a Type of personalized content for the REST service operation messages?

    I try to POST to the third party, documentum of EMC, REST service using service broker in 8.53 peopletools integration operations. Unfortunately, the third party only accepts a content type of 'application/vnd.emc.documentum+json', which I could not send PeopleSoft and use a message definition at the same time.

    In my service operation, if I do NOT fill the request message I can POST to the URI with the such custom content type defined in the property page of the connector in the routing. I have not found a way to do it and also present JSON content on demand, since there is no message associated with the operation. Is it possible to include in this type of message content without using a request message?

    If I DO not fill the request message I can't POST successfully because the message content-type of "application/json" gets passed as the content-type instead of the value in the property page of the connector from the routing. Is it possible to change the content type during the use of a message definition?

    Thank you

    Paul

    Hi Paul - you can turn on tracing by using the on demand connection as follows:

    1. on the routing set detail header and detail "journal".

    2. Main Menu > PeopleTools > Integration Broker > Service Operations Monitor > Administration > control installation Options

    -Enable logging of the bridge

    -On the registration of demand = 5 (to enable detailed logging)

    Note: On request connection only works for the outgoing synchronous Services. In this case, we should be fine. You will find the by transaction log file on your gateway web server... / applications/peoplesoft/PSIGW.war/WEB-INF/.

    I did it for one of the REST service operations my test (I'm on 8.52.22). I have my content type of message the value application/json to the operation of the service page. On the routing page, I added a connector property content-type=application/vnd.emc.documentum+json.

    Here are the results on the integration gateway logs:

    Message-ID:<-.................@nowhere>

    MIME-Version: 1.0

    Content-Type: multipart/related; Boundary = "Integration_Server_MIME_Boundary."

    Content-ID: PeopleSoft-internal-Mime-Message

    PeopleSoft-ToolsRelease: 8.52

    -Integration_Server_MIME_Boundary

    Content-Type: text/plain; Charset = UTF-8

    Content-Transfer-Encoding: 8 bit

    Content-ID: IBInfo

    Content-Disposition: inline

    Sync There ... * deleted for security purposes *... ContentSection0text/plainN

    CREATE5000000000000

    -Integration_Server_MIME_Boundary

    Content-Type: text/json

    Content-Transfer-Encoding: 8 bit

    Content-ID: ContentSection0

    Content-Disposition: inline

    username = * collected for security purposes * & password = * deleted for security purposes *.

    -Integration_Server_MIME_Boundary-

    The Content-Type of the delivery is sent as HTTP Connector of the target and the content of the message (text/json) Type property is always persistent (see the text in bold above). You can compare logs between your two scenarios (with and without the message in the POST) and see if you find something interesting.

    I even tried the following code to see if that helps, but I get the same results.

    & MSG. IBInfo.LoadRESTHeaders ();

    / * Adds additional headers not defined on the route * /.

    REM & MSG. IBInfo.ConnectorOverride = True;

    bRet = & MSG. IBInfo.IBConnectorInfo.AddConnectorProperties ("Content-Type", "application/vnd.emc.documentum+json", % Httpentete);

    & RESP = IntBroker.SyncRequest % (&MSG);)

    I'm working on a similar project at this moment where I'm integrating perceptual Nolij Web RESTful API (Document Management System). I had to resort to using a http client base (common of apache) java instead of broker of integration because of the similar frustrations with REST (cookies are lost, unable to deal with raw binary data in a response message, etc.).

    Benefits: Java provides total flexibility.

    Cons: As we are bypassing framework Integration Broker, we need everything (error handlng, logging, etc.) do it ourselves.

  • Try to download the trial and the system says "you are using an operating system that is no longer compatible with Photoshop. See system requirements for a complete list of the supported platforms. What can I do?

    Hi, I am looking to download the trial and the system says "you are using an operating system that is no longer compatible with Photoshop. See system requirements for a complete list of the supported platforms. What can I do?

    My laptop is a MAC Pro

    Well, what IS your version of operating system?

    MINIMUM requirements for programs of cloud... scroll down and check each program

    -http://helpx.adobe.com/creative-cloud/system-requirements.html

  • How should be written the script for the use of the maximum memory of the guest operating system ever?

    How should be written the script for the use of the maximum memory of the guest operating system ever?

    Please teach the name of the object and the type and order, etc.

    You should be able to do it with the cmdlet Get-Stat .

    Something like that

    Get-Stat -Entity (Get-VM $vmName) -Stat mem.usage.maximum -Start (Get-Date).AddDays(-7) | Measure-Object -Property value -Maximum | Select Maximum
    

    This will return the maximum percentage in the last 7 days for the guests, whose name is stored in the variable $vmName.

    ____________

    Blog: LucD notes

    Twitter: lucd22

  • ESXi 4.0 on Dell 1850 this host doesn't support VT you have configured the virtual machine to use an operating system 64-bit client.

    Hello

    , I have in 3 data centers Dell 1850, identical hardware configurations.  I installed Esxi 4.0 to the ISO from site Web de VMware dell custom help. He is successfully installed on all servers, without error at all. I've updated them all to the last generation, using VMware vSphere Client. I have a problem with one of the server when I want to use 64-bit machines, he realizes: this host does not support VT you have configured the virtual machine to use an operating system 64-bit client.  However, this host is not able to run 64-bit virtual machines or virtual computer has 64-bit support disabled. For more information, see http://www.vmware.com/info?id=152. I don't understand why I got this, servers are identical, versions of BIOS, firmware, and all updates are the same. There is also a warning in the configuration tab, on the State of health link.

    Thanks in advance for any helpful suggestion.

    Yes according to the description of CPU, it seems that they do not support intel VT:

    http://Ark.Intel.com/product.aspx?ID=28016&processor=&spec-codes=SL7DX, SL7HH, SL7PF, SL7TD, SL8KQ

    Please give points for any helpful answer.

  • Calculate the space used in the database!

    Hi all

    I can calculate the space used by using one of the following ways:

    1. determine the size allocated by issuing

    SELECT SUM(d.bytes/1024/1024/1024)
    FROM dba_data_files;

    2 calculate the free space by issuing

    SELECT SUM(bytes/1024/1024/1024)
    from dba_free_space;

    Space used will be the value of the first statement - value of the second statement. This is manually!

    Is it possible to combine these two queries?

    Thank you!

    Dan.

    You can certainly combine queries

    SELECT (allocated.bytes - free.bytes )/1024/1024/1024 used_gb
      FROM (select sum(bytes) bytes from dba_data_files) allocated,
          (select sum(bytes) bytes from dba_free_space) free
    

    Normally, you could group tablespace as well.

    But if you want just the amount of space used, it is probably easier to just

    SELECT sum(bytes)/1024/1024/1024 used_gb
      FROM dba_segments
    

    Justin

Maybe you are looking for

  • Removal of hub Yippy update

    Every 10 seconds my MacPro hands for about 3 seconds. The only way to fix it is to disconnect and reconnect or Mac restsart. But then it starts again. I opened the Console and think I found the cause. It seems that some malware from search engine Yip

  • Intercept a button for multiple buttons

    Hello. I am currently doing a VI in which I Boolean mutiple buttons in several groups (more than 100 buttons spread out over 4 groups). What I want is that, when a sense of belonging to a group touches the other buttons in the same group go to a shut

  • queue or table which is better?

    I need an array of clusters to store for the undefined term. I'm going to update, add new item. Table or a queue can be used to store clusters. That would be preferable to use in what concerns the use of memory, fast execution and other performance p

  • Downgraded victory 10-Win 7 - authentication were issues

    I was running widows 7 for many years without any problems. Upgrade to windows 10, some of my applications do not work so I reinstalled windows 7. Now he tells me my windows 7 is an illegal copy. Help!

  • I need a screen recorder that works.

    No sound from the rendering of a small number. I need a FREE good (without trial) Screen recorder for 7 64-bit.