Combine both the query

Hi all,
I am monitoring the flight information message.
Now we plan to alert a message if the flight information message were not get last 5 minutes comparewith Sysdate(Current system date and time).
Here the query :
SELECT MESSAGE,MESSAGE_DATE_TIME FROM UMESSAGE
Message Message_Date_Time
DUBAI 24/02/2009 11:39:16
ATHENS 24/02/2009 11:30:03
For example now the current date_time is 24/02/2009 11:45:16
The last message we got is 24/02/2009 11:39:16
After that message we did not get any message.It is almost more than 5 minutes.
Now I want to combine both the query .
SELECT SYSDATE FROM DUAL
SELECT MESSAGE,MESSAGE_DATE_TIME FROM UMESSAGE
how will I get it?
Please help.

Hi Rahul,
SQL> with umessage as (select 'DUBAI' message
                         ,to_date('24/02/2009 11:39:16', 'dd/mm/yyyy hh24:mi:ss') message_date_time
                    from dual
                  union all
                  select 'ATHENS' message
                         ,to_date('24/02/2008 11:30:03', 'dd/mm/yyyy hh24:mi:ss') message_date_time
                    from dual)
-- end of test data                   
select case
          when (sysdate - max(message_date_time)) * 24 * 60 > 5 then 'Alert'
          else 'Msgs Comming'
       end
  from umessage
CASEWHEN(SYS
Msgs Comming
1 row selected.Hint: We haven't heard from Athens in a year.
Regards
Peter

Similar Messages

  • SDO_FILTER and SDO_RELATE combined in the same query

    Is it possible to combine these two operations?
    I have a query that ideally should use SDO_RELATE for polygon data (some 25 million records). However it takes too long to run.
    For curiosity's sake I tried using SDO_FILTER and again this takes hours. Again for curiosity's sake I combined the two and records are returned in about 2 mins. Please see the query below (to simplify matters I have used point data).
    SELECT
    FROM
    table t
    WHERE
    MDSYS.SDO_RELATE(
    t.geometry,
    MDSYS.SDO_GEOMETRY( 2001,
    null,
    MDSYS.SDO_POINT_TYPE( 501900, 308000, null ),
    null,
    null
    'mask=anyinteract querytype=WINDOW'
    ) = 'TRUE'
    AND MDSYS.SDO_FILTER(
    t.geometry,
    MDSYS.SDO_GEOMETRY( 2001,
    null,
    MDSYS.SDO_POINT_TYPE( 501900, 308000, null ),
    null,
    null
    'mask=anyinteract querytype=WINDOW'
    ) = 'TRUE'
    As I see it, in this case SDO_FILTER is doing the primary filtering part. SDO_RELATE is doing primary filtering again followed by secondary filtering the resulting data which is why it is quicker. The data does appear to be correct.
    Now am I barking up the wrong tree? Whether I am or not, why is this combination faster than individual use? I would appreciate any thoughts on this please.
    Cheers guys
    James

    something else is going on, although without seeing the real query it is hard to know.
    SDO_RELATE is a supoerset of SDO_FILTER. With SDO_FILTER and index query is done, with SDO_RELATE an index query is done, then the relate is done on the geometries returned by the filter query.
    What kind of index are you using?
    What version of spatial are you using?
    Can you post the query window?
    Are your geometries valid?

  • I bought 26 new songs under my work e-mail and now i can't copy them to my i-pod because it has another music library on it. How can i combine both user id's to the same purchased account

    I have 2 user id's with apple, i bought 26 songs from my laptop recently using my work e-mail. I plug my i-pod to sync it and it says that my i-pod is tuned with another library. i don't want to erase the songs I have already because they are about 760 and the new ones are 26 only. how can I combine both user id's and consolidate all the music into one user id?
    everytime i try to do something it asks me to reset the password. I have done it already 6 times.
    there is no phone # to call.
    Thanks
    Elena

    Alright, please follow these steps in order to get it working properly again.
    Please change your Apple ID back to your old email address (that you used as Apple ID before) here: http://appleid.apple.com
    Then go to all your devices - iPhones, iPads, Mac etc. - ("Settings > iCloud") and delete your iCloud account from this devices (+ turn off Find My iPhone, but I guess it will ask you that anyway)
    After that go back to http://appleid.apple.com sign in again, and now change your Apple ID again to your new email address.
    Finally, set up your iCloud account on all your devices again.
    Now, everything should working properly again.

  • I have two apple accounts, but can only access one. I did all the steps to recover the older account's password but nothing worked. I need to access the older account to update apps. Also would there be a way to just combine both accounts?

    I have two apple accounts, but can only access one. I did all the steps to recover the older account's password but nothing worked. I need to access the older account to update apps. Also would there be a way to just combine both accounts?

    Were you able to reset the account's password ? If not then how did you try to get it reset e.g. http://iforgot.apple.com (which would have sent it to the rescue email address if you have one on that account) ? You can also try contacting iTunes Support in your country to get it reset : http://support.apple.com/kb/HT5699
    And no, accounts can't be merged nor content transferred between accounts.

  • How to combine both values and subquery in the insert statement

    Hi everybody,
    This is a case of inserting rows into a final results table from a temporary one. Actually, one of the fields is not always given in the temporary table. Thus, when inserting the rows into the final results table, an error message comes up to.
    More clarification:
    final results table(F_RESULT): field1, field2, field3 ( they are also primary keys with not null constraint)
    temporary table(TEMP): field2, filed3
    Is it possible to combine both values and subquery branchs of the insert statement:
    Insert into F_RESULT (field2,field3) select field2,field3 from TEMP;
    Insert into F_RESULT (field1) values (0);
    into only one like this:
    Insert into F_RESULT (field1,field2,field3) values (0, select field2 form Temp, select field3 from Temp);
    Or there is another more effective solution. The main problem for me is the message that doesn't accept the null value. From the data integrity point of view, it is accepted to set field1 to zero.
    Any hints?
    Thanks for your reply.

    That's easy, you can select any value from a table:
    Insert into F_RESULT (field1,field2,field3)
    select 0, field2, field3 from Temp;

  • BRAIN416 InfoObject 1KYFNM is used in both structures of the query

    Hi Expert,
    I have some problem with MDXTEST on BW 3.5 which i select multiprovider to generate MDX Staement but it goes to ABAP Debugger "CX_RSR_PROG_ERROR" and message BRAIN 416 information said "InfoObject 1KYFNM is used in both structures of the query".
    Anyone please explain me what should i do????
    Thank you for your help
    =SJ=

    Dear RajNi,
      In This Multiprovider A, i use only 1 infoset which only 1 ODS B.
      I'm so confuse because i create new ODS like ODS B and do step like Multiprovider A.
    Please help me if you have ever seen like that.
    Many thanks
    =SJ=

  • InfoObject 1KYFNM is used in both structures of the query

    I am getting the error message - "InfoObject 1KYFNM is used in both structures of the query", while executing the query. Can you please help me remove this error and proceed with the query execution?
    Thanks and Regards,
    Sachin Kalani.

    Hi Sachin,
    As the error suggested, make sure that u have used that KF only once in ur Query definition.
    Regards,
    Rajkandula

  • I just upgraded from i-tunes 10 to i-tunes version 11.1.3 in order to sync my i-phone.  All my libraries now come up now as one combined library, which makes it frustrating  and difficult to find my songs.  Can I have both the 10 and the new 11.1.3 on ?

    I had to upgrade  to i-tunes 11.1.3  from my old i-tunes 10  so that my i-phone could get synced to i-tunes. I used to have several i-tunes libraries on my computer for various subjects.  Like for movies, bird recordings, and  songs I wrote myself. Now when I open i-tunes all the libraries open up at once in one library, it is completely reorganized,  making it almost impossible to find my old songs, playlists, movies, etc.  I just got done organizing my libraries, and now its all confused and Im terribly frustrated. How can I get my old organization back, and is it possible to have several libraries again, or both the old and new i-tunes on the same hard drive? Anyone have any advice how to organize my new i-tunes ?

    What a waste of space to paste the code.
    Why not ask in the iLife > iPhoto forum where your question belongs.

  • Combine two select query

    Hi All,
    Many thanks for all kind support so far.
    I have two report (sql query)
    I want to add both the sql query
    1st sql query
    select distinct(a.item_number)
          ,a.quantity - b.quantity
    from QUANTITY_ONHAND_ATP a,BACKLOG_ATP_LT_CW b
    where a.item_number = b.item_number
    order by item_number2nd sql query
    select distinct(wb.item_number)
           ,wb.quantity - be.quantity
           ,a.quantity - b.quantity
    from BACKLOG_WEEK_BEFORE_ATP wb
        ,BACKLOG_ATP_ET_CW be
        ,BACKLOG_WEEK_AFTER_ATP a
        ,BACKLOG_ATP_GT_CW b
    where wb.item_number = be.item_number
       and a.item_number = b.item_number
       and wb.item_number = a.item_number
       and be.item_number = a.item_number
       and wb.item_number = b.item_number
       and be.item_number = b.item_number
    order by wb.ITEM_NUMBERIn 1st sql query i have 129 records and in 2nd sql query i have 14 records. I want to combine these two sql query. If the item_number of 1st sql query is not there in 2nd one then display it as it is in 1st sql only.
    Any help how to do that.
    Regards

    Hi,
    the gerenal approach to combine the results of two or more SQL queries would be the
    UNION / UNION ALL
    INTERSECT
    MINUS
    SQL clauses. Union just combines the results; INTERSECT will return the rows which are present
    in both result sets and MINUS will reduce the first result set by the rows of the second.
    Basically it works like this
    select * from emp where deptno = 10
    union all(
    select * from empo where deptno = 20
    All the queries must have identical columns in the result set - same number of columns
    and the same data types. So you would have to add a column to your first SQL query ...
    select distinct(a.item_number) item_number,
    to_number(*,null*) first_value
    ,a.quantity - b.quantity second_value
    from QUANTITY_ONHAND_ATP a,BACKLOG_ATP_LT_CW b
    where a.item_number = b.item_number
    order by item_number
    and in the second query I'd recommend to use the same aliases ....
    Does this help
    -Carsten
    Deutschsprachige APEX-Community: Tipps, Tricks, Best Practice
    http://tinyurl.com/apexcommunity
    SQL und PL/SQL: Tipps, Tricks & Best Practice
    http://sql-plsql-de.blogspot.com
    Twitter: @cczarski

  • Master data is not getting displayed in the Query Designer

    Hi,
    I have a DSO in which I have an InfoObject called Emp No. in the Data Field.
    The Emp.No is being maintained as master with (Emp Name, Address, Telephone No, DOB) as attributes.
    I have loaded the data in the Emp. No. master. Then tried loading the transaction data in DSO.
    The Emp.No is there in the DSO active data, but in the query designer its not getting displayed.
    Hope its clear.
    Please help.
    Thanks

    Hi,
    I have brought the Emp. No. in the Key Field and also have activate the master data again.
    Yet my Query Designer doesn't have the Emp. No.
    I have done a full load for both Master and Transaction.
    Please advice me what the other alternative.
    Thanks

  • Error While Filtering a Particular Value in the Query Navigation

    Hi ALL,
            we have a time charecteristic 0FISCPER in our query and the output of the query  is fine until we filter this on the variant  V3 ,system is throwing an error
      "System error in program SAPLRRK0 and form SORT_END_TRUE-01- (see long text)"
         i have tried to fix this in "analysis and repair of infoobjects " by mentioning the name of the  infocube  then the system is showing the inconsistancies by  the  following messages 
    >>InfoCube XFIGL_C11 was marked as a Cube with an inconsistent time dimension.
    >>Record with the DIMID 44 contains non-fitting time characteristics
    >>This DIMID is used by 2475 records of the fact tables
    >>No master data found for characteristic of test described subsequently
    >>Time characteristic 0FISCPER value 102006000 does not fit with time char 0FISCPER3 val 0
                this error is there both on the development and also the production servers. any light thrown on this issue is a awewlcome and i promise to reward points,
    regards

    Hi,
    There are a couple of threads on the same issue.
    Refer to these, just might be handy.
    Re: Uncaught_exception in Report Designer
    Program error in class SAPMSSY1 method  : UNCAUGHT_EXCEPTION in Report
    Good Luck!
    Sandeep Tudumu

  • Content Tab: None of the fact tables are compatible with the query request

    Hi All,
    **One thing I am not clear yet of all my years with OBIEE is working with the content tab in BMM.**
    I have made a rpd the joins in physical layer as shown below:
    https://picasaweb.google.com/114804305606242416264/OBIEEError#5663056545119428530
    And the BMM layer as:
    https://picasaweb.google.com/114804305606242416264/OBIEEError#5663056519553812930
    Error I am getting when i run a request from the 3 columns from the selected 3 tables is:
    Dim - Comment Code Details
    Fact - Complaint
    Dim - Service Details
    Error Codes: OPR4ONWY:U9IM8TAC:OI2DL65P
    State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 14020] None of the fact tables are compatible with the query request Sr Num:[DAggr(Fact - Complaint.Sr Num by [ Dim - Service Details.Sr Cat Type Cd, Dim - Comment Code Details.Cmtcode name] )]. (HY000).
    I get no error for consistency.. I read everywhere and I know i need to set the appropriate aggregation levels in the various dims and facts LTS properties to help OBIEE understanding our model, but how to do that.. how do i decide... how should I approach, what should be the aggregation level, what details.
    When i click More button i see different options: Copy, Copy From, Get Levels, Check Level, what do these mean.
    Aggregation Content, group by - Logical Level or Column which one should i choose and how should I decide.
    Can anyone explain the Content Tab in details and from scratch with some example and why we get these errors.... I know many people who are well versed with many other things related to RPD but this. A little efforts of explaining from you guys will really be appreciated.
    Thanks in advance,
    Dev

    Hi Deepak,
    Option 1:
    My tables in physical layer are joined as below:
    D1--> F1 <--D2--> F2 <--D3
    Same way i model it in BMM
    D1--> F1 <-- D2--> F2 <--D3
    Here D1 is non Conformed Dimension for F2 and D3 is non Conformed dim for F1. Later create Dimensional hierarchies, I tried setting up the content levels
    I go Sources>content tab of Fact F1 I set
    Dimensions----------- Logical level
    D1---------------------- D1 Detail
    D2---------------------- D2 Detail
    D3---------------------- D3 Total
    then, I go Sources>content tab of Fact F2 I set
    Dimensions----------- Logical level
    D1---------------------- D1 Total
    D2---------------------- D2 Detail
    D3---------------------- D3 Detail
    Then, I also go in all the dimensions and set their content levels to Details, but it still gives me errors not sure where I am going wrong in setting the content levels.
    I need to know whether the way I have modeled it in BMM is right,
    Option 2:
    I can combine the two facts in a single Logical Fact or the above design should also work.
    (F1&F2)<--D1, D2 , D3 joined separately using complex logical joins.
    what will be the content tab details?
    Thanks,
    Dev

  • Can't omit both the rowset and the row element?

    consider the simple document below. Notice that row-element and
    rowset-element are both empty, so neither type of element will
    be generated. Also notice that the xsql:query tag is embedded in
    other tags.
    I get "oracle.xml.sql.OracleXMLSQLException: The row enclosing
    tag or the row-set enclosing tag is ommitted; consequently to
    get a well formed XML document, the result can only consist of a
    single row with multiple columns or multiple rows with exactly
    one column each." However, in reality the result will be a valid
    XML document because I enclosed the query in a single top-level
    <table> tag. So the error checking code in the XSQL servlet is
    generating a generating a false positive (that is, seeing an
    error that isn't there).
    My question is, how can I work around this problem? I know I can
    let the servlet generate a rowset element and use an XSLT
    stylesheet to remove it but is there a another way?
    Thanks,
    Brian
    By the way, the "numbers" table contains the numbers 1-1,000,000
    and so it can be used to generate multiple copies of the output
    of any query. In this example, I expect to get 55 <th> tags in
    the output (yes, my HTML table is really that wide), all nested
    in a single <tr> tag which is nested inside a single <table> tag.
    <table connection="XXX"
    xmlns:xsql="urn:oracle-xsql"
    xmlns='http://www.w3.org/1999/xhtml'>
    <tr><th rowspan='2'>ID</th>
    <xsql:query rowset-element=''
    row-element=''>
    <![CDATA[
    SELECT 'fvc'          AS "th"
              , 'fev1'     AS "th"
              , 'fef25_75'     AS "th"
              , 'fev1/fvc'     AS "th"
              , 'vc'          AS "th"
              , 'tlc'          AS "th"
              , 'rv'          AS "th"
              , 'frc_n2'     AS "th"
              , 'frc_pl'     AS "th"
              , 'erv'          AS "th"
              , 'dlco'      AS "th"
         FROM numbers
         WHERE n < 5
    ]]>
    </xsql:query>
    </tr>
    </table>

    In XML, single quotes are equivelent to double quotes. This
    enables you to have attribute values like "That's Neat" and
    'About 2" Long'.
    The problem is that an xsql query can only return a tree as a
    fragment (e.g. there must be one root element). I think this is
    too restrictive.

  • Bex Query: Too many table names in the query The maximum allowable is 256

    Hi Experts,
    I need your help, Im working on a Query using a multiprovider of 2 datastores, I need to work with cells to assign specific acconts values to specific rows and columns, so I was creating a Structure with elements from a Hierarchy, but I get this error when I'm half way of the structure:
    "Too many table names in the query. The maximum allowable is 256.Incorrect syntax near ')'.Incorrect syntax near 'O1'."
    Any idea what is happening? is ti possible to fix it? do I need to ask for a modification of my Infoproviders? Some one told me is possible to combine 2 querys, is it true?
    Thanks a lot for your time and pacience.

    Hi,
    The maximum allowable limit is 256 holds true. It is the max no. of characteristics and key figures that can be used in the column side. While creating a structure, you create key figures (restricted or calculated) and formulas etc.. The objects that you use to create these should not be more than 256.
    http://help.sap.com/saphelp_nw70/helpdata/EN/4d/e2bebb41da1d42917100471b364efa/frameset.htm
    Not sure if combination of 2 query's is possible.  You can use RRI. Or have a woorkbook with 2 queries.
    Hope it helps.

  • HT203167 I have 2 iTunes accounts.   How do I combine in the same library?

    I have 2 iTunes accounts.   How do I combine both into one library?

    It's not currently possible to delete an account, all you can do is stop using it. If you have any content that you purchased/downloaded with that account then it will remain tied to that account (you can't move or transfer content from one account to another) - so you will need to remember the id and password if you ever want to re-download it and/or authorise it on a new computer.

Maybe you are looking for

  • PDF printing with embedded HTML

    Hi all.... I am running Apex 4.0.2.00.07 on 10.2.0.4. I have a report that looks beautiful on a web page it's in in an interactive report with a 2 level grouping the data is 4 columns image, html table, image, html table The image is not stored in th

  • Japanese Characters are showing as Question Marks '?'

    Hi Experts, We are using Oracle Database with below nls_database_parameters: PARAMETER VALUE NLS_LANGUAGE AMERICAN NLS_TERRITORY AMERICA NLS_CURRENCY $ NLS_ISO_CURRENCY AMERICA NLS_NUMERIC_CHARACTERS ., NLS_CHARACTERSET WE8MSWIN1252 NLS_CALENDAR GREG

  • EPM system security is not initialized properly

    Hi, We are in the process of installing 11.1.2.2 on Windows 2008 server. Step 1. we installed Foundation Service, Reporting and FM Step2. 1st did configuration of foundation service and Performance Management Architect Result - Successful. Was able t

  • How to filter array of file-names?

    Hi everybody, I'm trying to populate a list with files of a specific file type and then import the selection from my list into my current AE project. I've got a folder with many subfolders. So far I only managed to check through all the folders by us

  • How to increase display time of Toast notifications in Windows 10?

    Hi, I want to know how to increase display time for Windows toast notification in Windows 10.