Login
Register
Search
Home
Forums
Jobs
LawsonGuru
LawsonGuru Letter
LawsonGuru Blog
Worthwhile Reading
Infor Lawson News Feed
Store
Store FAQs
About
Forums
Infor / Lawson Platforms
S3 Systems Administration
Strange Oracle results with sysdate in query
Home
Forums
Jobs
LawsonGuru
LawsonGuru Letter
LawsonGuru Blog
Worthwhile Reading
Infor Lawson News Feed
Store
Store FAQs
About
Who's On?
Membership:
Latest:
Chris Radcliffe
Past 24 Hours:
0
Prev. 24 Hours:
0
Overall:
5187
People Online:
Visitors:
200
Members:
0
Total:
200
Online Now:
New Topics
S3 Customization/Development
Cobol - Extract Current Time
4/24/2024 7:21 PM
How do you extract just the Current System Time in
Lawson Landmark
LPL INSTR Functions
4/5/2024 8:32 PM
I'm writing a simple report using the Create R
Infor SCM
Translating 856 to get the ~ REF^CN^ field
4/3/2024 8:24 PM
We are trying to get the tracking number which is
IPA/ProcessFlow
Sample XML file create Flow
4/3/2024 3:43 PM
Hello everyone, I am new to creating XML files
Lawson S3 HR/Payroll/Benefits
bn105 error message
3/26/2024 6:40 PM
I need to change some of the set ups in our Life I
IPA/ProcessFlow
IPA executing Job
3/13/2024 7:08 PM
New to the IPA world and was wondering, can an IPA
Lawson S3 HR/Payroll/Benefits
Life Age Reduction on benefits plans
3/12/2024 7:15 PM
For our optional life we have an age based coverag
Lawson S3 HR/Payroll/Benefits
BN53.1 Add-In
3/7/2024 3:31 PM
We are migrating to Solstice. They require a
Lawson Business Intelligence/Reporting/Crystal
Domain Name Change
3/5/2024 7:45 PM
Our domain name needs to change and was hoping I c
S3 Customization/Development
Cobol calling Shell Script
2/29/2024 1:27 PM
Has anyone created or modified a Lawson Cobol prog
Top Forum Posters
Name
Points
Greg Moeller
4184
David Williams
3349
JonA
3288
Kat V
2984
Woozy
1973
Jimmy Chiu
1883
Kwane McNeal
1437
Ragu Raghavan
1348
Roger French
1311
mark.cook
1244
Forums
Unanswered
Active Topics
Most Liked
Most Replies
Search Forums
Search
Advanced Search
Topics
Posts
Prev
Next
Forums
S3 Systems Administration
Strange Oracle results with sysdate in query
Sort:
Oldest First
Most Recent First
You are not authorized to post a reply.
Author
Messages
David Britton
Veteran Member
Posts: 53
6/4/2013 1:42 PM
I am getting very strange results when I use "sysdate-30" in a query. Is this a bug in Oracle? I get same results from TOAD, SQL Plus on Windows PC and SQLPlus on my (Unix) Lawson server.
If the sysdate check is first I get incorrect results. If the sysdate check is second I get the correct results.
Below is a sample of the query I was trying to run followed by a query that does return the correct results. The only difference is if the sysdate clause is before or after the OR statement. These queries have lots of parens , I tried with varying numbers of parens with no difference in results.
Oracle Database 11g Release 11.2.0.1.0 - 64bit Production
-- Incorrect results
SQL> select count(*) from employee emp
where
(emp.TERM_DATE >= (sysdate-30)) OR (emp.TERM_DATE = TO_DATE('01/01/1700', 'MM/DD/YYYY'))
;
COUNT(*)
----------
5
--Correct results
SQL> select count(*) from employee emp
where
(emp.TERM_DATE = TO_DATE('01/01/1700', 'MM/DD/YYYY')) OR (emp.TERM_DATE >=(sysdate-30))
;
COUNT(*)
----------
1506
SQL>
David@SOM
Posts: 3
4/24/2014 6:37 PM
I found this interesting as I just did a similar sql with END-DATE and sysdate. I copied from your post and ran both your sql's, I got the same result # for each. Can't see why you would get different results. We are also running 11g.
Kwane McNeal
Veteran Member
Posts: 479
4/24/2014 7:05 PM
I ran this also, I got the same results as David@SOM. I was using Google, and it seems you may want to look for a bug since you're on 11.2.0.1, and that's old, or if you're running in a RAC setup, could be an issue. I'm running 11.2.0.4.0
Kwane McNeal
Veteran Member
Posts: 479
4/24/2014 7:13 PM
Did some more digging, seems like someone ran into something very similar to you. See this URL:
https://community.oracle....ead/2331662?tstart=0
I'd get the patch levels up to date.
Kwane
You are not authorized to post a reply.