?
Solved

a strange problem

Posted on 2006-07-21
6
Medium Priority
?
188 Views
Last Modified: 2008-02-26
hi all,

i have a very strange problem. i have query like this

select
a.id as queue_id, b.*, c.text
from xxx a left join yyy b on (a.SMS_ID = b.id)
left join zzz c on (c.content_id = b.content_id)
where
is_send = 'N' and
day in (-1, to_number(to_char(SYSDATE, 'D'))) and
(minute = -1 or
minute  <= to_number(to_char(sysdate, 'HH24')) * 60 + to_number(to_char(sysdate, 'MI')))
and
c.text is not null and
(b.last_sent_sms is null or b.last_sent_sms != c.text) and
(c.content_date is null or (to_char(sysdate, 'yyyy/mm/dd') = to_char(c.content_date, 'yyyy/mm/dd')))
and (
b.comparison_operator is null or
(b.comparison_operator = '=' and b.comparison_value = c.price) or
(b.comparison_operator = '>' and b.comparison_value > c.price) or
(b.comparison_operator = '<' and b.comparison_value < c.price)
)

when i run this from toad it works fine and return 2 row but when i want to run in my java project it work very strangely and return only 1 work.

i couldnt understand anything why it behaves like that. it problem cause of java.

if you help me, i will be pleased.
thanks in advance.
0
Comment
Question by:komputer
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
6 Comments
 
LVL 2

Expert Comment

by:RoyalNepal
ID: 17155378
Try to use brackets..after "Where" clause and after two "and".
0
 

Author Comment

by:komputer
ID: 17166200
i' ve just realised the problem cause of to_number(to_char(SYSDATE, 'D')) to return the day of week. it changes depend on the regional settings. for american it returns 2 for monday while returns 1 for UK.

is there any function that runs independent of regional settings to return the week of day in oracle.

or any solution to be independent of regional settings to calculate the week of day.

thanks...
0
 
LVL 6

Accepted Solution

by:
valipotor earned 500 total points
ID: 17276953
Hi
I think this solves your problem
http://www.experts-exchange.com/Databases/Oracle/Q_21460136.html

valipotor
0
 
LVL 2

Expert Comment

by:RoyalNepal
ID: 17280427
Is your problem solved? Please let me know.
0
 

Author Comment

by:komputer
ID: 17496375
earthman2's solution seems work.
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Suggested Courses
Course of the Month8 days, 14 hours left to enroll

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question