To check the State exists query

Hello

I have a query where I use is the function to check the weather dates fall between the dates, something like this

Select 1 from T1 a

where there are

(select 1 from T2 b where a.col_1 between b.col_1 and b.col_2

and a.col_2 between b.col_1 and b.col_2);

I need to check if the a.col_2 is sysdate, then check only a.col_1 between b.col_1 and b.col_2 else check

a.col_1 between b.col_1 and b.col_2

and a.col_2 between b.col_1 and b.col_2

SQL > select * from T2 a

2 where exists (select 1 from T1 b where a.start_Date between b.start_date and b.end_Date

3 and (a.end_date between b.start_date and b.end_Date or trunc (a.end_date) = trunc (sysdate)));

START_DATE END_DATE

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

8/22/2000-7/2/2007

7/3/2007-8/11/2008

8/18/2008 7/10/2015

Tags: Database

Similar Questions

  • How to check the performance of query via the command sqlplus prompt

    Hello

    I work in the production environment, I want to check the performance of the queries in a production environment, we have no specific tools such as the expliin plan, TK Proff.

    I need chek performnce of sqlplus command line query

    Please let me know the process of query tuning of sqlplus command promt

    Here to explain plan:

    SQL> explain plan for
      2  select * from employees where employee_id = 170;
    
    Explained.
    
    SQL> select * from table(dbms_xplan.display());
    
    PLAN_TABLE_OUTPUT
    -----------------------------------------------------------------------------------------------
    Plan hash value: 1833546154
    
    ---------------------------------------------------------------------------------------------
    | Id  | Operation                   | Name          | Rows  | Bytes | Cost (%CPU)| Time     |
    ---------------------------------------------------------------------------------------------
    |   0 | SELECT STATEMENT            |               |     1 |    69 |     1   (0)| 00:00:01 |
    |   1 |  TABLE ACCESS BY INDEX ROWID| EMPLOYEES     |     1 |    69 |     1   (0)| 00:00:01 |
    |*  2 |   INDEX UNIQUE SCAN         | EMP_EMP_ID_PK |     1 |       |     0   (0)| 00:00:01 |
    ---------------------------------------------------------------------------------------------
    
    Predicate Information (identified by operation id):
    ---------------------------------------------------
    
       2 - access("EMPLOYEE_ID"=170)
    

    You can also use autotrace, which is super easy:

    SQL> set autotrace on
    SQL> select * from emp;
    
                   EMPNO ENAME      JOB                        MGR HIREDATE
    -------------------- ---------- --------- -------------------- --------------------
                    7369 SMITH      CLERK                     7902 17-DEC-1980 00:00:00
                    7499 ALLEN      SALESMAN                  7698 20-FEB-1981 00:00:00
                    7521 WARD       SALESMAN                  7698 22-FEB-1981 00:00:00
                    7566 JONES      MANAGER                   7839 02-APR-1981 00:00:00
                    7654 MARTIN     SALESMAN                  7698 28-SEP-1981 00:00:00
                    7698 BLAKE      MANAGER                   7839 01-MAY-1981 00:00:00
                    7782 CLARK      MANAGER                   7839 09-JUN-1981 00:00:00
                    7788 SCOTT      ANALYST                   7566 19-APR-1987 00:00:00
                    7839 KING       PRESIDENT                      17-NOV-1981 00:00:00
                    7844 TURNER     SALESMAN                  7698 08-SEP-1981 00:00:00
                    7876 ADAMS      CLERK                     7788 23-MAY-1987 00:00:00
                    7900 JAMES      CLERK                     7698 03-DEC-1981 00:00:00
                    7902 FORD       ANALYST                   7566 03-DEC-1981 00:00:00
                    7934 MILLER     CLERK                     7782 23-JAN-1982 00:00:00
    
    14 rows selected.
    
    Execution Plan
    ----------------------------------------------------------
    Plan hash value: 3956160932
    
    --------------------------------------------------------------------------
    | Id  | Operation         | Name | Rows  | Bytes | Cost (%CPU)| Time     |
    --------------------------------------------------------------------------
    |   0 | SELECT STATEMENT  |      |    14 |   532 |     3   (0)| 00:00:01 |
    |   1 |  TABLE ACCESS FULL| EMP  |    14 |   532 |     3   (0)| 00:00:01 |
    --------------------------------------------------------------------------
    
    Statistics
    ----------------------------------------------------------
            480  recursive calls
              0  db block gets
             92  consistent gets
              9  physical reads
              0  redo size
           1630  bytes sent via SQL*Net to client
            520  bytes received via SQL*Net from client
              2  SQL*Net roundtrips to/from client
              7  sorts (memory)
              0  sorts (disk)
             14  rows processed
    

    This guide has lots of good info:
    http://docs.Oracle.com/CD/B19306_01/server.102/b14211/TOC.htm

  • IDE channel - check the State DMA/PIO

    Hello

    I tried to check the DMA/PIO State of my system, but I couldn't find something that mentions primary/secondary channel under "controllers IDE ATA/ATAPI" in Device Manager. From what I've read in various forums, it is the way to do it, and I also noticed that a few people could not find the ' primary/secondary way' thing as well. (but I could not find a solution to the issue)

    My problem is that some USB ports (2 of 4) I used normally would slow when I transfer data to and from the external HARD drive. Now, I've been move to the other 2 USB ports, and I could see the difference in the rate of transfer. This has happened before with my XP system, but I was able to access the channel primary/secondary and turned them all to DMA, which is something that I can't do now with my other Vista system. So now I would really check on that, and I need help to make...

    My system:
    Windows Vista (updated with all the Windows update)
    Intel Core 2 Duo P9600 2.67 GHz
    4 GB OF RAM
    nVidia GeForce GTX 260-1 GB memory
    Realtek/Creative SoundBlaster
    HARD drive 320 (which is good, it's almost full, leaving about 20 GB of free space, but the problem that I mentioned above happened when I had still 60 GB of free space, as a few months ago)

    It would be great if someone can help me to brighten my days here. I'm not a geek, but certainly not an illiterate as well.

    Thank you in advance!

    Hi PC45,.

    In case you can't find primary/secondary channel under "controllers IDE ATA/ATAPI" in Device Manager, you can try to expand IDE ATA/ATAPI controllers and check for ATA channel 0 or right-click on it and click Properties. Later, click on the tab for setting advance, check if you can see the status of the DMA mode.

    Because you are connected to the USB and the data transfer rate is slow, and it works fine when connected to a different USB port, I suggest you to update the USB drivers on the motherboard manufacturer's website.

    You can also navigate to the link below and follow the steps to update the drivers on your computer.

    http://Windows.Microsoft.com/en-us/Windows7/update-a-driver-for-hardware-that-isn ' t-work correctly

    Also, if you have any security software installed on your computer, you can try to temporarily disable and check if the date transfer rate is better. If you find the security software, the origin of the problem, you can contact the manufacturer of security software and check if there is no parameter to be changed. Later, re-enable the security software.

    I hope this helps. Let us know the status.

    Thank you and best regards,

    Srinivas R Microsoft Support.

    Visit our Microsoft answers feedback Forum and let us know what you think

  • Check the State of the virtual machine remotely

    Hi all

    I want to check the status of my virtual machines remotely (start, stop, reset, suspend, resume). Is there a simple way to do this?

    In fact, I am using the remote built into VMware workstation's screen but if I stop the virtual machine, I am not able to restart and go on the host computer. Is there a solution for workstation as the Web management or something else?

    Thanks for help

    See vmrun.exe in the VIX\ \Program Files\VMware\VMware directory.

    You can script a whole bunch of things quite easily.

    Mike

  • Way to check the stats on listened to bit rate versions?

    Does anyone know if Flash Media Server has of a function which allows to display statistics on which particular streams is delivered?

    Seems this would be a handy tool to determine flow rates are important to continue to provide, and which are superfluous, and is it time to try encoding at higher bit rates.


    Thank you

    Mike

    You would like to check the access.00.log file to see what streams are made by FMS what time.

  • How to use the not exists query

    Hello

    Using obiee 11g,.
    I would like to know how treat does not exist the application in the obiee11g,

    the query is like that

    Select count (a.col1), a.col2 from table1, table2 b where a.col1 = b.col1
    and not exists
    (by selecting d.col1 in table 3, table 4 e)
    where d.col1 = e.col1 and d.col1 = a.col1)
    A.col2 Group

    There are 4 tables.
    Table1, table2, table 3, tabel4

    That's what I need in a report, these tables are used in other places also.
    prefer if possible to do an analysis of i.e.e report itself.
    If this isn't possible then can be in Dr. because if I change in RPD it can reflect all the places
    and not in a report itself.

    Thank you

    This implementation in the report itself can be a difficult and tedious work... But it is better to be RPD - physical type - select a Table
    USE NOT IN in place of NOT exist... You can just use a SELECT statement to SELECT the TYPE of TABLE

    I hope that's clear

  • How to load a form after checking the State of a record

    Dear friends,

    Application VB.net 2005

    Server: SQL Server 2005

    Table name: Tbl_Test

    FieldName: availability

    I use VB.net to develop a piece of software, the feature is just check one filed named "availability" and if the value is 'Yes' then load a form named frmStatus. I wrote the Code in FormLoad event but I would like to know how to write Code in a Module or in a class to load the form if the product of the value of the 'availability' = 'yes '.

    As it is an exe file regular to run every minute, I am facing a problem in which the cursor disappears for a while when the SQL statement, the execution to verify the status of availability in the SQL Server database.

    Please help me to solve the problems.

    Thank you.

    Hello

    The question you posted would be better suited to the MSDN Community. Check out the link and ask the question.

    http://social.msdn.Microsoft.com/forums/en-us/vbgeneral/threads

  • check the exsistance of query inside a struct

    in CF 7

    I want to do this...

    < cfif isdefined('variables.getReport["STATUS"][1]') >

    <! - do stuff - >

    < / cfif >

    But it seems that CF does not like this convention. Even if its happy enough to use the convention itself NOT in a statement isdefined.

    Ideas otherwise, how could I test of the existence of the ' variables.getReport ["STATUS"] [1]?

    Is set takes a string and check if there are any variables named with the same string.

    "variables.getReport" is the name of the variable.

    ['STATUS'] [1] are a key structure index and table of this variable, but has nothing to do with the name of the variable.

    
    

    Is how we can check all three layers of this variable.

    Post edited by: ilssac sorry, arrayIsDefined() has been added to the CF 8, re-reading I see that you are on CF7.  Until you update, you will need to use something like "arrayLen (variables.getReport ["STATUS"]) GTE 1" for the third test.

  • Smartphone blackBerry, checking the State of BB

    Hi recently I had a torch 9860 as a gift and I use just the BBM service with vodafone India network and now I want to know if it is a phone without danger or not?  Coz it is unlocked and bought US

    In addition I can't update this phone OTA and also PC thru also. I do not see 'software update' option. Please help me, I can't stop using BB

    You are welcome.. take you some time and keep us updated, simply follow the steps above and I hope that you will not feel any problem. (Install only a single BONE what pack at the same time on your PC or another OS pack could collide, so delete any extra pack OS if you have your PC before installing the operating system you want)

    Good luck.

  • Check the values of the hierarchy

    Hello
    I have a requirement where I need check the data of the child if the parent is not satisfying the condition
    Here is the sample table and data.

    I have a test_test1 of the Table that contains the data parent and child
    create table test_test1 (dependent_id number ,dependent_upon_id number)
    
    insert into test_test1 values(2,1)
    insert into test_test1 values(3,2)
    insert into test_test1 values(4,3)
    
    select dependent_id ||' depends on'|| ' '||dependent_upon_id  
      from test_test1
    There is another table to check the status of the id in the table above.
    create table test_test2 (id number,i_m varchar2(11))
    
    insert into test_test2 values(1,'ISUE')
    insert into test_test2 values(2,'MN')
    insert into test_test2 values(3,'MN')
    insert into test_test2 values(4,'MN')
    Now if the lookup id is 3, check the State, be it ISUE / MN.
    If the State is "MN" then check with that is the State of his child;  4 (the child can be greater than 1)
    If id 4 has the "MN" State, to consult because he was a child extra until he got the State as 'ISUE. If there is not more far childs are 'MAY', and then mark search (3) as inactive, active id otherwise.

    Note: The id is not in additional order that I gave in the data of test as 1,2,3... etc.

    Could you help me how to achieve the above requirement


    Thank you..

    Published by: smile on December 30, 2011 11:57
    select *
      from (
            select dependent_upon_id  as ID
                  ,case when instr(sys_connect_by_path(t2.i_m,','),'ISUE')>0
                        then 'ACTIVE'
                        else 'N/A'
                    end               as status
                  ,max(level) over(partition by dependent_upon_id)  as maxl
                  ,level                                            as l
              from test_test1 t1
              join test_test2 t2
                on (t2.id = t1.dependent_upon_id)
             connect by prior t1.dependent_upon_id = t1.dependent_id
            union all
            select e.id
                  ,decode(e.i_m, 'ISUE', 'ACTIVE', 'N/A') status
                  ,1
                  ,1
              from test_test2 e
             where not exists(select 1
                                from test_test1 r
                               where r.dependent_upon_id = e.id )
           )
    where ID = 2 -- 3
      and maxl = l 
    
  • How to follow the direction of Adobe 'Flash uninstall"to check the Firefox browser for the 'status' of Adobe Flash? --

    I downloaded Adobe uninstall (for Mac, OS x 10.4ff) and he ran to get rid of old shards of Adobe Flash, be very careful to follow the Adobe provided through their Web site. The last thing they ask you to do is to "Check that the uninstall is complete", by restarting your computer and then open your browser and check the status of the Flash Player. BUT it seems not to be a way to check the State of Adobe Flash Player on current versions of browsers Mozilla product.
    How can I check that the old version of 'Flash Player' is really gone?

    Firefox 41.0.2 on Mac OS X 10.8.5

    edited by e-mail from the public and robots to spammers

    See also the "tools > Modules > Plugins" (topic: addons) page and all: plugins page.

  • Checking the status of the main sequence in reminder PostUUT

    I'm checking the State of the main sequence in the PostUUT callback, running TS 2014 SP1.
    Say, the main sequence generates an error. PostUUT I check and get the following

    Parameters.Result.Status "error".
    Parameters.Result.Error.Code

    Parameters.Result.Error.Msg

    Parameters.Result.Error.Occurred False

    Parameters.Result.Error.Occurred should not be set to True? If this isn't the case, please explain why.

    Thank you.

    In the process model of the step that calls the MainSequence reminder is set to ignore errors.  It is for the rest of your group of main step can run.  That is why we only sets result false but retains all the error information.

    If it were me, I would trigger on the State channel.

    Hope this helps,

  • App without head: how to check the status

    1. I read this on the BB site:

    Criticism

    Process that must be running at all times (for example, system processes)

    In the foreground

    Processes that are running in the foreground

    Background

    Processes that run in the background

    Stop

    Process involved in RAM without running

    The question is can we write the code to check the States of the app to trigger certain activities?

    I also want to know the other possible States of the life cycle such as: "application started", "closed app"...

    A problem critical of the app without head is memory management, and we can only until BB have a better explanation on the life cycle of the app without a head.

    2. for an application in the short-term, event after 20 years, the app is still listed on memory and CPU usage. That seems abnormal, because I guess that after 20 years, the application will be stopped and not be able to use the memory and CPU more.

    Can someone explain?

    Thank you very much!

    Would you like to take a look at this app, I wrote that has a component without head and uses QLocalSocket to communicate between the headless and the (https://github.com/blackberry/Cascades-Community-Samples/tree/master/wakemebybeacon) user interface process. There is also a blog explaining how it works here: http://devblog.blackberry.com/2014/07/wake-my-beacon/.

    You can detect changes in status of process on the part without head like this (https://github.com/blackberry/Cascades-Community-Samples/blob/master/wakemebybeacon/WakeMeByBeaconSe...) and manipulate them like this (https://github.com/blackberry/Cascades-Community-Samples/blob/master/wakemebybeacon/WakeMeByBeaconSe...).

    When a component without a head (process) is distributed will be passable for 20 seconds, after which it is moved to a queue where it receives no processor, but can be awakened (marked as executable) of certain classes of events. While stopped the headless process always retains a memory footprint, but is not available.

  • Checking the status did not return ACS version after update 4.0 to 6.0

    We are in the (stable) the ACS of 4.0 to 6.0 upgrade process.  The only problem that we see, is that after the upgrade, check the State does not return a version.

    We use the check.js provided by Adobe, but get to the result of the call.

    .. / Status? check = version

    The appeal has changed, or are we missing a configuration somewhere property?

    I guess nobody don't Adobe never look at this forum...

  • ESXi 6.0 - SSH Command to check the status of running tasks

    Hi all

    What I'm trying to do is quite simple, but do not know whether it is complex or not.

    I'm checking the State of a task via SSH. You know, like that of the lower part of the vSphere Client where it shows you the task and the status of it. I need to monitor the % of the deployment of the MV EGGS in various hosts via a script but can't find the command to do, but would be nice to be able to check any task and its status.

    What I found so far:

    http://KB.VMware.com/selfservice/microsites/search.do?language=en_US & cmd = displayKC & externalId = 1013003

    But that was not helpful at all. I tried but could not get information about the deployment.

    Thank you all for any help or lead, you may have.

    Hello world

    I found the answer myself, which was indeed in the URL I posted.

    I just had a problem to see a small change in orders.

    In step 7, it says task_info and I wrote get.tasklist with the task identifier.

    Thank you guys and I hope at least that it might help someone trying to do what I'm doing and reading VERY well orders, haha

    Kind regards

    Martin

Maybe you are looking for