Date Greater Than Operator

I am comparing two date fields from two tables. Both are in DATE format. The dates look like this: 22-Apr-2006 07:00:10 AM and 01-Jun-2007 12:00:00 AM. I am adding this statement to a WHERE clause:
and vendors.vend_obsolete_date > document_xref.acceptance_date;
In this particualr case, I should get no result because the 1st date came before the 2nd date. But when I run my program, it seems to be ignoring my > statement. Is using a greater than sign the proper syntax to compare if the 1st date field is bigger (came after) another?
Thanks!

Greater than works on DATE columns, no problem. A simple test confirms it.
SQL*Plus: Release 10.2.0.1.0 - Production on Mon Jul 9 17:50:52 2007
select 'oops, something is wrong' as result
from   dual
where
  to_date( '22-Apr-2006 07:00:10 AM', 'dd-Mon-yyyy hh12:mi:ss AM' )
  > to_date( '01-Jun-2007 12:00:00 AM', 'dd-Mon-yyyy hh12:mi:ss AM' )
no rows selectedThere must be something else about your query or data that's causing the anomaly.
Joe Fuda
SQL Snippets

Similar Messages

  • Greater than operator for obiee analysis

    Hi ALL,
    Just want to ask if it is possible to use date for the greater than operator in creating obiee analysis?
    for example: I want to get months greater than January 2015 for specific measure.
    Thanks in advance

    but I'm using Oracle 9i r2
    The question is why greter than, lesser than, does not workWorks on 9.2.0.8:
    SQL> select * from v$version where rownum = 1
    BANNER                                                         
    Oracle9i Enterprise Edition Release 9.2.0.8.0 - 64bit Production
    1 row selected.
    SQL> with mydata as
       select xmltype('<Values><Value>data1</Value><Value>data2</Value></Values>') MyXmlColumn from dual
    select * from mydata t where existsNode(t.MyXmlColumn, '/Values/Value') < 3
    MYXMLCOLUMN                                                              
    <Values>                                                                 
      <Value>data1</Value>                                                   
      <Value>data2</Value>                                                   
    </Values>                                                                
    1 row selected.

  • Aprroval for Invoice have due date greater than 100 days

    Hi all!
    I would like to create query to approve for Invoice have due date greater than 100 days.
    SELECT 'true' from OINV  where max(datediff(day, OINV.docduedate, getdate()))>100 and OINV.docstatus ='O' and  cardcode = $[$4.0.0] group by cardcode
    It's not working. Can you help me!
    Thanks!

    Hi Tien,
    Hopefully not trying to teach you how to suck eggs here, but it looks like the query is doing too much. There shouldn't be a need to perform a "GROUP BY" in a query to dictate if an approval is to be triggered or not, only the criterai to make it happen.
    For examle, the following code will send a transaction for approval if the customers code equals a specific reference.....
    SELECT 'TRUE' FROM ORDR T0 WHERE ${ORDR.CardCode} = 'ABC001'
    If you're wanting a query to just return a boolean answer based on the date criteria, you might want to try adapting your query to something like.......
    SELECT 'true' from OINV where max(datediff(day, ${OINV.docduedate}, getdate()))>100 and ${OINV.docstatus} ='O' and  cardcode = ${$4.0.0}
    (As an additional tip, in order to test a query that you're wanting to use as either a formatted search or approval type selection, when in the transaction, if you locate the relevant saved query under "Tools > Queries > User Queries" etc, where you have references to specific fields e.g. ${ORDR.CardCode}, this will pick up the values from the current record and give you a what if scenario. I tend to have just a "Temp" query I use for WIP type queries of this nature.)
    Note - You need to replace the bracket's "{}" with square ones, I've used the others as the forum posts as a http reference.
    Hope this helps!
    Julian

  • Exit or BAdi for Validating GR posting date Greater than PO creation date.

    Hi all ,
    Is there any Exit or BAdi for restricting users to post GR date greater than PO creation date.
    Regards
    Gibi Philip

    Gibi,
    check this:
    MB_CIN_LMBMBU04                         posting of gr
    Amit.

  • When choosing date on a banking site a box appears telling me to use a to date greater than from date.

    I am trying to get a report from a bank site and a box pops up asking me to choose a to date greater than from date. I have the correct dates chosen. Is there a fix or away around this.

    Check the date and time in the clock on your computer: (double) click the clock icon on the Windows Taskbar.
    *https://support.mozilla.com/kb/Secure+Connection+Failed

  • Select only dates greater than static value

    I am retreiving dates from an sql table, currently I am pulling all the dates. How do I only pull dates greater than say 5/1/2008?
    Below is the current code.
    String strSQL = "Select convert(nvarchar, wk_dt, 101) as outDt From t_fiscal_weeks Where wk_dt <= '" +
    DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.MEDIUM).format(new java.util.Date()) + "' Order by wk_dt desc";
    Thanks for the help

    Always, always, always use a PreparedStatement: [http://java.sun.com/docs/books/tutorial/jdbc/basics/prepared.html]

  • Greater than operator for date in obiee analysis

    Hi all,
    I just need your help. is it possible to use the greater than or less than operator (in filter) for date in creating analysis?
    FOr example: I need to have the greater than months from "January 2015" for specific measure.
    Thanks!

    Somehow the person records for this person have become corrupted. Have you any idea how that might have happened? Options:
    1) Someone or some program has issued a direct table update on per_all_people_f
    2) Someone has used Help > Diagnostics > Examine to modify the data
    3) An Oracle bug. This one is unlikely but could happen if using an unusual form (Shared Person Form, for example) and perform a weird combination of actions/keystrokes. But you'd need to be able to reproduce it if you want Oracle to fix it.
    If you're support contract is invalid or you don't have a support contract your options are limited. You can either:
    a) Bring your patch level up-to-date and then raise an SR. If Oracle agree to provide a script to fix it they'll probably just do direct table updates to resolve this record.
    b) Fix this yourself using direct table updates. This obviously isn't supported either. If you do this, make sure you know what you're doing and get it 100% right first time. BE VERY CAREFUL!
    Obviously I strongly recommend option b.

  • Xpath query using greater than operator

    I'm trying to evaluate some xml to determine if it matches some criterium.
    MyXmlColumns contains the following kind of data "<Values><Value>data1</Value><Value>data2</Value><Values>"
    When I execute the following query I get zero rows returned when it should match some rows containing this data.
    select * from mydata
    where existsNode(MyXmlColumn, '/Values/Value[. > "data1"]') = 1
    The question is why greter than, lesser than, does not work, and if there is any alternative.
    If I use equals operator, or greater than but using a number it works.
    I know that I can use XmlExists function but I'm using Oracle 9i r2 so it's not an option.
    Thanks in advance for any suggestion.

    but I'm using Oracle 9i r2
    The question is why greter than, lesser than, does not workWorks on 9.2.0.8:
    SQL> select * from v$version where rownum = 1
    BANNER                                                         
    Oracle9i Enterprise Edition Release 9.2.0.8.0 - 64bit Production
    1 row selected.
    SQL> with mydata as
       select xmltype('<Values><Value>data1</Value><Value>data2</Value></Values>') MyXmlColumn from dual
    select * from mydata t where existsNode(t.MyXmlColumn, '/Values/Value') < 3
    MYXMLCOLUMN                                                              
    <Values>                                                                 
      <Value>data1</Value>                                                   
      <Value>data2</Value>                                                   
    </Values>                                                                
    1 row selected.

  • Greater than operator in Hana

    Hi, I have a quey inside a Xml File and I need to use the Comparasion Operator for "Greater than" in this way : &gt;
    Question: Does Hana Syntax support  &gt; ?

    Hi there,
    Was '>' or '<' not working from XML? I used a > operator in a calculated column  and then exported the HANA model to see the XML file of it. It has something like this below:
    <formula>IF(&quot;EMP NO &quot; >=3,&quot;EMPLOYEE NAME&quot;,&quot;GENDER&quot;)</formula>
    Regards,
    Krishna Tangudu

  • Greater than operator in SQL

    Hi friends,
    A table has 2 colums A and B.How i can return a flag ,say 1 if A is greater than B or 0 if A is less than B,by using SQL.
    Can any one help me out.
    thanks and regards,
    Ajith

    select a,b,case when a > b then 1
                    when a=b   then 0
                    else -1
               end FLAG
    from table;                                                                                                                                                                                                                                                                               

  • Select records with a date greater than today

    Hi,
    I have a table that lists leases, and each lease has an expiration date (stored in three fields; EXPYR, EXPMN, EXPDA).
    I want to create a report that selects just those records that have an expiration date later than the date when the report is run.
    Any ideas?

    Jon,
    I'm assuming that the 3 fields are Year, Month & Day...
    Create a formula...
    Date(EXPYR, EXPMN, EXPDA)
    Then, for your record selection, create the following formula...
    {@DateFormula} > CurrentDate
    HTH,
    Jason

  • Less Than operator not working, Greater Than operator works comparing dates

    I need to compare dates to conditionally display a row. If the DateDueJulian_ID5<= AsOfDate_ID47 display otherwise don't. I get all rows but if I reverse the logic >= the condition works and only displays the one matching row.
    I am using the Template Builder 10.1.3.4.1 and WORD 2007.
    Any help is appreciated!
    Thanks
    XML Source:
    <Header_Section_S3>
    <Delinquency_Report_ID225>DELINQUENCY NOTICE</Delinquency_Report_ID225>
    <VersionName_ID270>0001</VersionName_ID270>
    <Report_or_Video_Title_ID53></Report_or_Video_Title_ID53>
    <Remit_To_Text_ID68>Remit To:</Remit_To_Text_ID68>
    <RemitToAddressLine1_ID2>XXXXX</RemitToAddressLine1_ID2>
    <XX_XX_XX_ID259>2010-08-25</XX_XX_XX_ID259>
    <Date__ID258>Date</Date__ID258>
    <RemitToAddressLine2_ID5></RemitToAddressLine2_ID5>
    <RemitToAddressLine3_ID8></RemitToAddressLine3_ID8>
    <As_of_Date__ID46>As of Date</As_of_Date__ID46>
    <AsOfDate_ID47>2007-11-29</AsOfDate_ID47>
    <A_R_Delinquency_Notice_Detail_Join_S2>
    <DocVoucherInvoiceE_ID1>1897265</DocVoucherInvoiceE_ID1>
    <DateInvoiceJ_ID3>2007-10-11</DateInvoiceJ_ID3>
    <DateDueJulian_ID5>2007-12-10</DateDueJulian_ID5>
    <NameRemark_ID7></NameRemark_ID7>
    <AmountOpen_ID11></AmountOpen_ID11>
    <AddressNumber_ID17></AddressNumber_ID17>
    <UniqueKeyIDInternal_ID19></UniqueKeyIDInternal_ID19>
    <KAV_CustomerPONumber_ID23></KAV_CustomerPONumber_ID23>
    </A_R_Delinquency_Notice_Detail_Join_S2>
    <A_R_Delinquency_Notice_Detail_Join_S2>
    <DocVoucherInvoiceE_ID1>1897265</DocVoucherInvoiceE_ID1>
    <DateInvoiceJ_ID3>2007-10-11</DateInvoiceJ_ID3>
    <DateDueJulian_ID5>2007-11-10</DateDueJulian_ID5>
    <NameRemark_ID7></NameRemark_ID7>
    <AmountOpen_ID11></AmountOpen_ID11>
    <AddressNumber_ID17></AddressNumber_ID17>
    <UniqueKeyIDInternal_ID19></UniqueKeyIDInternal_ID19>
    <KAV_CustomerPONumber_ID23></KAV_CustomerPONumber_ID23>
    </A_R_Delinquency_Notice_Detail_Join_S2>
    RTF:
    <?for-each:Header_Section_S3?>
    <?if:DateDueJulian_ID5 <= AsOfDate_ID47?>
    <?DocVoucherInvoiceE_ID1?>
    <?DateDueJulian_ID5?>
    <?AsOfDate_ID47?>
    <?end if?>
    <?end for-each?>

    Found the solution! Use Date_Diff.
    <?if:xdoxslt:date_diff('d',DateDueJulian_ID5,AsOfDate_ID47,$_XDOLOCALE,$_XDOTIMEZONE)>=0?>

  • Dates Greater Than, Less Than, but what about the dates between?

    This is what my data looks like.
    Employee# StartsWork EndsWork
    1_________8/15______8/16
    2_________8/16______8/19
    3_________8/17______8/17
    I need to know how many employees I have working on any given day.
    The table below shows the dates across the top, and the data in the cells represents the total number of workers on any given date.
    Date_____8/15_______8/16_______8/17________8/18________8/19_______8/20
    Workers___1__________2__________2___________1__________1__________0
    FYI: This report does not contain any prompts. It just shows me the next 6 days.
    I was trying something like this but without any success: Create a column
    CASE WHEN current_date > "StartWork" AND current_date < "EndsWork" THEN '1' WHEN (current_date+1) > "StartWork" AND (current_date+1) < "EndsWork" THEN '2'
    and so on, then just use the column to sort the rows. I can use some count function later to finish it.

    Create three date dimensions, Join first date dimension (d1) with Start Date, join second date dimension (d2) with End date, create a dummy join (1=1) with 3rd date dimension.
    On the report or in PRD create a measure as follows.
    CASE WHEN D3.Date <= d2.Date and D3.Date >= D1.Date then 1 ELSE 0 END

  • Using SSRS Date Range- Data Not shown for date greater than by Analysis Services

    Hello Friends,
     I am using Date Range filters(Start and End Date) in my SSRS Report. The Problem is that if i am using the start date will be today, then the end date will be the future date by using Analysis Service as my Data Source, the report is not generated.
    I don't know why it happens? If I give the date range filters before the current date, then the report will shown.
    The problem is that the future date is not in my database. Could you please answer for this. I am struck in here,.
    Table contains : 1-7-14 ,
    2-7-14,
    3-7-14,
    If my Date Range will be 1st to 3 of 7th month, then the report shows the data.
    if my date starts with 1st of the 7th month and ends in the future, then the report will not shown the 2nd and 3rd records...
    Please teach me why?

    Your question should be posted to the appropriate MSDN forum.  This forum is for questions regarding Microsoft Certifications.

  • Effective start date greater than effective end date in per_all_people_f

    Hi !
    Upon running the perus11i.sql, we found that there are overlapping of dates and effective_start_date > effective_end_date in per_all_people_f.
    Can somebody point me to right link for the document that can fix this problem?
    We're currently using using 11.5.10i
    Appreciate any help.
    Thank You
    Elmer

    Somehow the person records for this person have become corrupted. Have you any idea how that might have happened? Options:
    1) Someone or some program has issued a direct table update on per_all_people_f
    2) Someone has used Help > Diagnostics > Examine to modify the data
    3) An Oracle bug. This one is unlikely but could happen if using an unusual form (Shared Person Form, for example) and perform a weird combination of actions/keystrokes. But you'd need to be able to reproduce it if you want Oracle to fix it.
    If you're support contract is invalid or you don't have a support contract your options are limited. You can either:
    a) Bring your patch level up-to-date and then raise an SR. If Oracle agree to provide a script to fix it they'll probably just do direct table updates to resolve this record.
    b) Fix this yourself using direct table updates. This obviously isn't supported either. If you do this, make sure you know what you're doing and get it 100% right first time. BE VERY CAREFUL!
    Obviously I strongly recommend option b.

Maybe you are looking for

  • Photos on TV: Composite vs. Component

    I use the component video connection to watch iPod movies on our TV. However, our sync'd photos will not display via this connection. Would they display using composite video? Thanks.

  • [kde] "Only show tasks from the current desktop" doesn't work for max

    Hi, I have two monitor setup (laptop + main monitor) and I would love to use "Only show tasks from the current desktop" option in KDE Task Manager but for some strange reason it doesn't work for me. Well, it works but only partially - for restored/un

  • CS6 beta ACR7 'Color Detail' slider BUG Win7-64bit

    I'm not sure if this happens on everyones system... Steps to reproduce: 1) Open a photo (RAW, jpg, etc) with heavy color noise in ACR 7.0.0.308 (like ISO > 6400) 2) In the Detail tab, set the noise reduction 'Color' slider to about 40. 3) Then drag t

  • DETERMINE_DUE_DATE

    Hello Masters, I am trying to get due dates with determine_due_date fm but i can't.i have searched this forum about this fm and i could not find any related things to my problem. also i debugged my program and saw that FAEDE-REBZG is empty.this is wh

  • Rendering utilisation change

    Hi all, I have been using AE for many years now, largely for TV work, but recently I have been doing more feature work. When starting a render, I have noticed the machine is quiet, chugging along, tearing through the render at a decent clip. Coming b