By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,007 Members | 1,248 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,007 IT Pros & Developers. It's quick & easy.

Comparison problems

P: n/a
Hi there, can any one help me? I am new to DB2 sql, I will be using
the case statement to make comparisons in the select but I cannot get
it to work. The query below is an example of the comaprison I am tring
to do, it is not returning any rows. The column qactdat is a numeric
field which holds a date in the form yyyymmdd.

select integer(substr(qactdat,5,2)),
from qwfldat
where integer(substr(qactdat,5,2)) = integer((substr(qactdat,

If I remove the where clause, rows are returned. I cannot work out why
the comaprison is not evaluating to true, as they should both return
the same number.

Hope somone can help, many thanks,


Sep 12 '07 #1
Share this Question
Share on Google+
3 Replies

P: n/a
I figured out that this is because the column qactdat has some values
of 0. This meant that the substr(qactdat,5,2) was not evaluating
proply. I do find it strange that this didn't cause an error though or
just evaluate as false and return the rows that do have values in the

Sep 12 '07 #2

P: n/a
The column qactdat is a numeric
field which holds a date in the form yyyymmdd.
What data type did you specified for qactdat in CREATE TABLE qwfldat?

Sep 13 '07 #3

P: n/a
You must be using DB2 for iSeries.
Please ignore my previous post. Because, I don't know so much about

Sep 13 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.