Greater than is giving me equal to's

So I'm writing a procedure in PL/SQL that has the logic below:
SELECT
FROM
WHERE
    CASE
        WHEN travel_time IS NULL THEN NULL
        WHEN travel_time = 0       THEN NULL
        ELSE miles/(travel_time/60)
    END >
    CASE
        WHEN (SUBSTR(id, 2, 3) BETWEEN '099' AND '200')
            THEN 60
        ELSE 45
    END;In the result set, I'm getting records where the result of the first and second case statement are both 60.
So basically, if the result of the first case statement is GREATER THAN the result of the second case statement, the record is supposed to show up, but I'm getting records that are GREATER THAN OR EQUAL TO. I'm sure I could just change the second case statement to give 61 rather than 60, and I'm sure it would work. But shouldn't this logic work without having to do that?
Thanks!
Edited by: jjmiller on Mar 26, 2010 7:24 AM

As Frank said, a small test case (with CREATE TABLE and INSERTs) would help.
Works for me.
SQL> select * from v$version ;
BANNER
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi
PL/SQL Release 10.2.0.4.0 - Production
CORE     10.2.0.4.0     Production
TNS for Solaris: Version 10.2.0.4.0 - Production
NLSRTL Version 10.2.0.4.0 - Production
SQL> create table travel(id varchar2(3), miles number, travel_time number) ;
Table created.
SQL> insert into travel values (1, 10, 10) ;
1 row created.
SQL> insert into travel values (2, 60, 10) ;
1 row created.
SQL> insert into travel values (3, 46, 10) ;
1 row created.
SQL> insert into travel values (4, 60, null) ;
1 row created.
SQL> commit ;
Commit complete.
SQL> select * from travel ;
ID       MILES TRAVEL_TIME
1         10            10
2         60            10
3         46            10
4         60
SQL> select id, miles, travel_time, case when travel_time is null then null when travel_time = 0 then null else miles/(travel_time/60) end cmp1, case when id between '1' and '4' then 60 else 45 end cmp2 from travel ;
ID       MILES TRAVEL_TIME       CMP1       CMP2
1           10          10         60         60
2           60          10        360         60
3           46          10        276         60
4          600                                60
SQL> select * from travel where case when travel_time is null then null when travel_time = 0 then null else miles/(travel_time/60) end > case when id between '1' and '4' then 60 else 45 end ;
ID       MILES TRAVEL_TIME
2           60          10
3           46          10

Similar Messages

  • The code segment cannot be greater than or equal to 64K. - Windows 8

    Hello,
    I am having an issue on some windows 8 systems, a crash occurs in NtSetEvent, the exception thrown is "0x000000C8: The code segment cannot be greater than or equal to 64K.".
    This crash only occurs on Windows 8.
    The callstack doesn't help much
        KERNELBASE.dll!_RaiseException@16()    Unknown
        ntdll.dll!_NtSetEvent@8()    Unknown
        kernel32.dll!@BaseThreadInitThunk@12()    Unknown
        ntdll.dll!__RtlUserThreadStart()    Unknown
        ntdll.dll!__RtlUserThreadStart@8()    Unknown
    Could it be a bug within windows 8 ? If not what steps should I take to find the cause of this crash ?
    Thank you,
    Max

    I have a feeling like you have corrupted something.  Likely by stomping on memory due to a bug in your program such as a buffer overrun or use of a deleted object in C++.
    Although you may have incurred corruption to your registry through a variety of means, not limited to bad disk drives, or the unintentional write of bad data due to a bug in your program, if you are experiencing this on multiple systems, then registry corruption
    is less likely.  Which brings me back to the idea that you have a bug in your code that has trashed memory somehow.
    The stack traces and error codes do not indicate the cause of the problem.
    What does your program do??
    Without seeing at least some of the code, or knowing how big the scope of the code is, it's not useful for me to start guessing specifics of what may have happened.  But since you're not disclosing anything at all about your code apart from your exception,
    I'm forced to do some guesswork and just give general advice.
    Here are some easy classical strategies for locating the cause of the problem:
    Build your code in debug mode and run your code in the debugger.  (Yes, some people need to be told this.)
    Bisect the problem through revision control.  Back up to when the problem didn't happen and find the last revision that causes the problem.  (If you're not using a revision control system, start now.)
    Bisect the problem by eliminating chunks of code.  Trim out functionality until the problem goes away.
    Write unit tests.  Test the various pieces of your program to eliminate bugs.  At the very least, make use of assertions.
    Have a look at what your program is DOING when the crash happens.  Certainly there must be a cause.  Try to isolate the problem by associating it with a certain activity in your program.  Gate off functionality by introducing places where
    your program waits before proceeding.  At some point, you'll pass a point where the error can now occur.
    Run code analysis on your project and see if it comes up with any possible culprits.
    Don't ignore compiler warnings, they often indicate something that can turn into a bigger problem.  Compile at the highest warning level.
    Look at your usage of various API functions for logical mistakes.  Here are some examples:
    When using third party libraries or SDKs, have you initialized libraries appropriately?  Have you called all the appropriate initialization functions and used the APIs as intended?  Read documentation and make sure you are using calls appropriately.
    For functions that take a HANDLE, such as SetEvent, are you passing a valid handle?  Have you closed the handle but kept the old handle value around?
    When storing pointers to objects, have you accidentally deleted an object but kept its pointer around, only to make use of the pointer at a later time in your program?  This is particularly harmful when performing a write operation as you can corrupt
    just about anything.
    Are you using variables without giving them an initial value?  You may get unexpected values for variables if you do not initialize them.  This is particularly important for stack variables.
    When using arrays or string buffers, have you allocated enough storage for the bytes you are writing?  C++ doesn't detect reading or writing with an invalid array index as a problem.  It happily reads or writes past the end of your intended
    storage.  Such offences are called "buffer overruns".
    When multi-threading, are you taking steps to ensure data integrity?  Unsynchronized access to data from multiple threads is a notorious cause of strange and difficult to reproduce bugs.  Your data passes through states that you may not expect
    that can be observed by unsynchronized threads.  Use locking mechanisms appropriately and marshal your data diligently.
    Are you relying on valid input from an external source beyond your control such as a network client, database, or file?  Diligently validate all input that comes from an external source.  Be prepared for any situation that you can't control at
    compile time.
    Are you ignoring error codes?  Some functions may fail, but you may be assuming they have succeeded and then gone on to use invalid data.
    Look for mathematical errors.  Calculation of indices of arrays are a notorious culprit.  Beware of off by one errors.  Indices start at zero and go up to N-1, where N is the number of elements in the array.
    Beware of sentinel values.  Some functions such as "IndexOf" will return an index of -1 when not found and can result in a miscalculation of an actual index.
    Are you making use of
    RAII techniques in your code?  Failing to correctly allocate and deallocate resources can cause problems.
    Are you making use of unsafe casts?  C-Style casts say "I know what I'm doing", and you can get into dangerous situations.  Prefer static_cast<> over a C-Style cast wherever possible.
    Also look at your project settings for problems
    Have you accidentally mixed incompatible compiler settings between components?
    Approach debugging with an open mind.  Mark Twain said, "It ain't what you don't know that gets you into trouble. It's what you know for sure that just ain't so."

  • How do I disallow negative numbers in a selected group of cells (i.e. only allow values greater than or equal to zero)?

    I have a table of calculated values in Numbers, and I want to disallow negative numbers in the entire table. Any numbers that would be negative I would like changed to/displayed as zeroes, that way future calculations that may be based on this cell use the value of 0 for the calculation rather than the negative value. I have seen ways of doing this to single cells at a time, but I am interested in applying it to a large selection of cells.
    There is the Conditional Format option when you bring up the inspector, but I cannot get a custom rule to work for me. I select "Greater than or equal to" and I enter 0 in the box, but nothing changes. Can anyone help with this?
    Thanks

    A step toward simplifying the application of MAX to the issue, Jerry.
    This part, though:
    Now apply your long, animal-modeling, expressions to this new, interposing, table rather than the original.
    may still leave several references to be change from the original data table to the new one.
    One way to get around that is to use the Duplicate ("DATA-1) as the new table for raw data, and the Original (DATA) as the interposing table, using the formula =MAX(DATA-1::A2) as above, starting in DATA::A2.
    This way, the long expressions could continue to reference the original table (with its content now modified).
    ALTERNATE process:
    Find/Replace could also be used to speed the process of reassigning the modeling expressions to the duplicate table, as suggested by Jerry. But some cautions apply here.
    Find/Replace can be limited to Formulas only, but not to Some formulas only.
    Find/Replace can be limited to the Current Sheet only, but this can't be combined with Formulas only.
    More on this later, when I've had a chance to check some possibilities.
    Regards,
    Barry

  • Greater than or equal symbol not working

    Hi,
    I cannot get the "greater than or equal to" symbol to display properly. I can get the less than or equal symbol to display by typing Ctrl+q #, and then formatting it as Symbol font.
    According to the Character_Sets.pdf FrameMaker Online reference, the greaterequal symbol is Ctrl+q 3, but when I format it as Symbol, FrameMaker displays a box (which looks to me to be a non-printing character).
    Any suggestions on how I get a "greater than or equal to" symbol to display?
    Thanks,
    John B.
    FrameMaker 8 (8.0 p277)
    Windows XP SP 3

    Error7103 wrote:
    > I cannot get the "greater than or equal to" symbol to display properly.
    Try this...
    Click in margin.
    Format > Characters > Designer...
    Character Tag: [ Symbol ]
    Family: [ Symbol ]
    all else As Is or blank
    Commands: New Format...
    [*] Store in Catalog
    Click in Body Flow A.
    Special > Variable...
    [Create Variable]
    Name: [ char.symbol.greaterequal ]
    Definition: [ <Symbol>\xb3 ]
    [Add]
    [Done]
    [Insert]
    Advantages:
    Avoid frequent arcane typing: you only need to look up the special character entry sequence once per document (if that - we keep these var defs in a separate catalog for ease of application).
    Isolates special char encodings for dealing with eventual replacement by native Unicode glyphs and/or ports to platforms lacking legacy Symbol overlay font
    Isolates special char renderings for possible changes to font with native >= glyph
    Assures text inserted adjacent to symbol will be in native paragraph font, and not Symbol.
    Prevents spell checker from needlessly complaining.
    Is portable between FM platforms and releases, although \xb3 does appear as Š (cap s caron above) in Windows dialogs.
    Disadvantages:
    If you apply a Default ¶ Font to the para, the variable is no longer in Symbol font (but this is always the case for variables that use alternate fonts). You have to re-select the var (which may be hard to even see), and re-insert it.
    If you highlight the entire para, or just the text containing the var, and apply a new PgfTag, the variable likewise gets de-fonted. It has ever been thus.
    You have to search by Variable, and not by special character.
    So what do we suppose made this topic so popular that it's got over 1000 Views so far?
    I tried these instructions with great anticipation, but alas, it did not work for me.
    Maybe it works differently on FrameMaker 9. I even tried making a PDF to see if it just rendered differently on the screen, since you mentioned the display in Windows dialog boxes (even though I was just in the main flow).
    See the screenshot below for my results.

  • Greater than or equal to

    Hi everyone. I have what I think is a simple query (see
    below) that pulls date information from a table. As you can see
    from the query, I want it to pull dates for anything greater than
    and equal to today's date and anything less than and equal to a
    date one week from today's date.
    This works, however, CF does not output any events on today's
    date; it begins outputting tomorrow's events. Can someone point me
    in the right direction as how to fix this so dates for today are
    output as well? Thanks!

    For the "up through day" portion, I truncate the time component off of now(), add a day, and then use only the less than comparison. Example:
         <cfset variables.dt1 = dateAdd("d",1,int(now())) />
         <cfset variables.dt2 = dateAdd("d",-8,variables.dt1) />
         <p>dt1 = #variables.dt1# / dt2 = #variables.dt2#</p>
    This results into:
         dt1 = {ts '2013-09-28 00:00:00'} / dt2 = {ts '2013-09-20 00:00:00'}
    Lastly, use the results in your query comparison:
         where
              [someDateField] < <cfqueryparam value="#variables.dt1#" cfsqltype="CF_SQL_DATE" />
              and [someDateField] >= <cfqueryparam value="#variables.dt2#" cfsqltype="CF_SQL_DATE" />
    Also, the cfsqltype of CF_SQL_DATE seems to truncate the time component off the date for you in CF9 & CF10, but I don't like dependencies like that as I've been burned in the past. If you don't mind the risk, you can simplify the logic by removing the int() function from the above.

  • Greater than equal symbol are coming across as question mark

    Hi:
    Greater than equal symbols and Less than equal symbols are coming across as question marks in Jasper Reports. Do you have any suggestions of how to solve this?

    This is the same problem as your other thread, keep it in one thread please:
    http://forum.java.sun.com/thread.jspa?threadID=5194766

  • Greater than or equal to problem.

    Hey All,
    I'm building a script for Final Cut Pro (7) this is a small part of the entire script and I am having some difficulties getting this to work. So, the objective is to get a number from the user, then to have the number escalate as it repeats. I also need to make this number "Paste" in. However I cannot use the cliboard functions at all because they will be in use in a different part of the script.
    What this part was designed to do, (but doesn't do all the time ) is take the number submitted by the user, and break it down by digit and spit it back out in the form of a variable key code. Another part of the script would do the escalation of the number. But what I really need is to find out why the greater than or equal to/ less than or equal to are correctly segmentig the numbers, so the script doesn't try to do the input number more than once.
    set start_value to text returned of (display dialog "Start number?: " default answer "") as number
    if start_value is greater than or equal to 0 then
        if start_value is less than or equal to 9 then
            set start_value to start_value as string
            set start_value01 to 0
            set start_value02 to 0
            set start_value03 to the first item of start_value as number
        end if
    end if
    if start_value is greater than or equal to 10 then
        if start_value is less than or equal to 99 then
            set start_value to start_value as string
            set start_value01 to 0
            set start_value02 to the first item of start_value as number
            set start_value03 to the second item of start_value as number
        end if
    end if
    if start_value is greater than or equal to 100 then
        if start_value is less than or equal to 999 then
            set start_value to start_value as string
            set start_value01 to the first item of start_value as number
            set start_value02 to the second item of start_value as number
            set start_value03 to the third item of start_value as number
        end if
    end if
    if start_value01 is 1 then set O1 to 18
    if start_value01 is 2 then set O1 to 19
    if start_value01 is 3 then set O1 to 20
    if start_value01 is 4 then set O1 to 21
    if start_value01 is 5 then set O1 to 23
    if start_value01 is 6 then set O1 to 22
    if start_value01 is 7 then set O1 to 26
    if start_value01 is 8 then set O1 to 28
    if start_value01 is 9 then set O1 to 25
    if start_value01 is 0 then set O1 to 29
    if start_value02 is 1 then set O2 to 18
    if start_value02 is 2 then set O2 to 19
    if start_value02 is 3 then set O2 to 20
    if start_value02 is 4 then set O2 to 21
    if start_value02 is 5 then set O2 to 23
    if start_value02 is 6 then set O2 to 22
    if start_value02 is 7 then set O2 to 26
    if start_value02 is 8 then set O2 to 28
    if start_value02 is 9 then set O2 to 25
    if start_value02 is 0 then set O2 to 29
    if start_value03 is 1 then set O3 to 18
    if start_value03 is 2 then set O3 to 19
    if start_value03 is 3 then set O3 to 20
    if start_value03 is 4 then set O3 to 21
    if start_value03 is 5 then set O3 to 23
    if start_value03 is 6 then set O3 to 22
    if start_value03 is 7 then set O3 to 26
    if start_value03 is 8 then set O3 to 28
    if start_value03 is 9 then set O3 to 25
    if start_value03 is 0 then set O3 to 29
    tell application "TextEdit"
        activate
        tell application "System Events"
            tell process "TextEdit"
                key code O1
                delay 0.1
                key code O2
                delay 0.1
                key code O3
            end tell
        end tell
    end tell
    Text Edit being my test dummy for this part of the operation. I am on 10.8, a couple others will be on 10.7.
    Thanks for any help on this!
    Gabe

    The answer is clear when you step through the code.
    It starts off OK...
    set start_value to text returned of (display dialog "Start number?: " default answer "") as number
    Let's use the hypothetical value of 44 as the input.
    Your code progresses to the block:
    if start_value is greater than or equal to 10 then
    which evaluates to true (44 is greater than 10), so we proceed:
              if start_value is less than or equal to 99 then
    It is less than 99, so we're still good here...
                        set start_value to start_value as string
    Well, now you've coerced start_value back to a string object "44", it is no longer a number. That's OK for the purposes of this block, however, when you continue:
    if start_value is greater than or equal to 100 then
    here's where the problem reveals itself - you're now comparing start_value (the string value "44") against the number 100. Comparing strings to numbers is inherently dangerous - as you're seeing. The string value "44" is, indeed greater (in AppleScript's terms) than the number 100 (technically, the second operand (number 100) gets coerced to the type of the first operand (string "44") before the comparison is performed, so you're really comparing the strings "44" and "100" and a string that starts with '4' will always be greater than a string that starts with '1')
    The simplest solution is to not change the start_value variable mid-stream. So instead of:
                        set start_value to start_value as string
                        set start_value01 to 0
                        set start_value02 to the first item of start_value as number
                        set start_value03 to the second item of start_value as number
    do something like:
                        set start_value_string to start_value as string
                        set start_value01 to 0
                        set start_value02 to the first item of start_value_string as number
                        set start_value03 to the second item of start_value_string as number
    In this way you're making a text copy of your start_value, so the type doesn't change as your script progresses.
    There are other ways of solving this, of course - changing the type back, or reversing the operands in your greater than statements (so the string "44" gets silently coerced back to a number), but at the end of the day I recommend not changing the class/type of your variables.

  • Change "to equal" to "to be greater than" in Wait for Field to equal Value"

    In Sharepoint Designer 2010, in the workflow Action "Wait for Field to equal Value", I could change the "to equal" to "to be greater than". I can't find how to do this in SPD 2013.
    Can someone please help?
    Thank you!

    Hi
    PieterVanHeerden, is a big problem that gives us the change Microsoft . An option to mitigate this problem could be to use an additional workflow that runs whenever the item is updated . Workflow evaluate the condition that you need and when it is Ok, updates
    the value of a field used as flag called eg " Control_Hora_Inicio_Completo " with " true " value.
    In your current workflow you should modify the condition for the WorkflowF stops until the Control_Hora_Inicio_Completo field equal to " True " when it meets the Workflow continue and you're sure you have entered a value , whatever that is .
    I hope you can try and you work.
    Greetings from Argentina .
    Maxi
    Msorli

  • Camel Query : Calender list : Get Items agains given date that must be greater than and eqaul to start date and greater less than or equal to end date ?

    Camel Query : Calender list : Get Items agains given date that must be greater than and eqaul to start date and greater less than or equal to end date ?
    A Snap of Employee holiday list
    Case : Anne juul Sondergaar is on leave from 05-06-2014 to 07-06-2014
    I need a query to check wheither Anne juul is on leave at 06-06-2014 ????
    I am using this query that return nothing
    SPQueryquery =
    newSPQuery();
                                query.Query =
    @"<Where>
    <And>
    <And>
    <Leq>
    <FieldRef Name='Til' />
    <Value Type='DateTime'>"
    + WorkingStartDate.ToString("yyyy-MM-dd")
    + @"</Value>
    </Leq>
    <Geq>
    <FieldRef Name='Fra' />
    <Value Type='DateTime'>"
    + WorkingStartDate.ToString("yyyy-MM-dd")
    + @"</Value>
    </Geq>
    </And>
    <Eq>
    <FieldRef Name='Medarbejdere' />
    <Value Type='Lookup'>"
    + EmployeeName.Trim() +
    @"</Value>
    </Eq>
    </And>
    </Where>"
                                query.ViewFields =
    " <FieldRef Name='ID' />";
    Ahsan Ranjha

    Hello,
    Download CAML query builder from below location and use it to build your query:
    http://social.msdn.microsoft.com/Forums/sharepoint/en-US/f7b36ebc-6142-404a-8b04-9c87de272871/where-can-i-download-the-u2u-caml-query-builder-for-sharepoint-2010may-i-know-the-exact-link?forum=sharepointgeneralprevious
    Hemendra:Yesterday is just a memory,Tomorrow we may never see
    Please remember to mark the replies as answers if they help and unmark them if they provide no help

  • Get item Greater than and equal to today's date...

    Hi,
    We are having issue in getting item greater than today's from SharePoint List. We have a column in list with Date and Time Data type.
    I am using below code to get data greater than and equal to today's date.
    SPQuery query = new SPQuery();query.Query = "<Where><Geq><FieldRef Name='Expires' /><Value Type='DateTime'>"+ DateTime.Today.ToShortDateString() + "</Value></Geq></Where>";
    SPListItemCollection listItemCollection = list.GetItems(query);
    Please suggest what is wrong in above query.
    Regards,
    Amit Chhatbar

    Hi Amit,
    I guess the date is expected to be in UTC and ISO 8601 format. Use the below code and check if it works.
    DateTime.UtcNow.ToString("yyyy-MM-ddTHH:mm:ssZ")or DateTime.Today.ToString("yyyy-MM-ddTHH:mm:ssZ")
    Ram Prasad Meenavalli | MCITP | MCTS SharePoint | MCPD SharePoint | http://www.spdeveloper.co.in

  • Greater than or equal 0

    Greetings, I am new to the custom calculation scripting area.  I'm hoping someone can help with something I think may be straightforward.
    I need to show a value of 0 unless the sum of 3 fields is greater than 25.  So, if the sum is less than 25, output is 0.
    Any help would be greatly appreciated!!!

    Sorry, that posted by mistake. If the sum is equal to or less than 25, the output is 0. If the sum is greater than 25, it would be the sum of 3 fields.

  • How can I type the symbol for greater than or equal to

    I wish to type the symbol for greater than or equal to in an equation but my keyboard does not have such a symbol

    Mathematical Operators - 2200-22FF
    :≥ &nbsp; &nbsp; &amp;#x2265; 8805 GREATER-THAN OR EQUAL TO
    :http://www.sql-und-xml.de/unicode-database/mathematical-operators.html
    If this is for HTML use &amp;ge; to create &ge;
    you can bring up CharMap (charmap.exe)
    go down 11 windows (of 10 rows each) and it is on bottom row
    You should be able to type as Alt+8805 on the Numeric keypad (not number row)
    or on laptop with NumLock off as Fn+Alt+8805
    but that is not working for me and I verified that hex(x2265) and decimal (8805)
    values are equivalent.

  • Getting job_queue_processes' must be greater than or equal to 1.  Fix ...

    Hi All,
    I'm running the emca -config dbcontrol db command and getting the follow msg:
    SEVERE: 'job_queue_processes' must be greater than or equal to 1. Fix the error(s) and run EM Configuration Assistant again in standalone mode.
    I'm working on sun machine 5.10 and Oracle 10g.
    Any ideo how can I fix tis problem?
    Thanks in advance,
    Serge

    Please see the following thread;
    Re: Enterprise Manager Repository reconfigue
    Ogan

  • Why domain functional level should be greater than or equal to forest FL?

    We know that domain functional level must be greater than or equal to forest functional level. Why is that so?
    My perspective is if we set FFL to windows server 2008 r2 and DFL to windows 2003, active directory recycle bin won't be available to the domain whose FL is windows 2003. Is that right?

    My perspective is if we set FFL to windows server 2008 r2 and DFL to windows 2003, active directory recycle bin won't be available to the domain whose FL is windows 2003. Is that right?
    Greetings!
    Active Directory Recycle Bin needs to be implemented in a forest with 2008 R2 forest functional level. Because it was added in 2008 R2 operating system. In order to have a 2008 R2 forest functional level you need to raise all the child domains DFL's first.
    Regards.
    Mahdi Tehrani   |  
      |  
    www.mahditehrani.ir
    Please click on Propose As Answer or to mark this post as
    and helpful for other people.
    This posting is provided AS-IS with no warranties, and confers no rights.
    How to query members of 'Local Administrators' group in all computers?

  • :Offset specification "+4" is greater than or equal to field length ("4")

    hi all,
    when i writing routine for Date field(len 8) in transfer rules, im getting below error
    <b>:Offset specification "+4" is greater than or equal to field length ("4")</b>
    the same routine in another old dev server , there were no syntax errors.
    pls can anyone help me out in this
    thanks

    Activated transfer rules w/o routine , and again i created the same routine , no syntx errors.
    thanks

Maybe you are looking for