flag record based on range for dates

S_BEGDA    H_BEGDA   S_endda
20100419  20100705   99991231
20031016  20080623   20090331

i want to flag H_BEGDA as Y and other as N on the condition that 20100705 range not between S_BEGDA  and  S_endda while other in between the range

i am doing
Case When H_Begda not BETWEEN S_Begda And S_Endda Then 'Y' Else 'N' End As Test1 both record show me Y

S_BEGDA    H_BEGDA   S_endda  
20100419  20100705   99991231 Y
20031016  20080623   20090331 N
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

slightwv (䄆 Netminder) Commented:
I don't understand.

I run your test and I get 'N' for both.

20100705 is between 20100419 and 99991231
and 20080623 is between 20031016  and 20090331

What am I missing?

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
sam2929Author Commented:
My bad question don't make sense
DavidSenior Oracle Database AdministratorCommented:
This is just an old developer's trick, but I was taught to avoid NOT conditions if the statement could be reworded.  Such as:

Case When H_Begda BETWEEN S_Begda And S_Endda Then 'N' Else 'Y' End As Test1

Is your source data clean enough that you don't need to check for misformatted strings?  Would you ever have, for example, 30131332?  If so, what are the business rules?
slightwv (䄆 Netminder) Commented:
>>My bad question don't make sense

As much as I appreciate the points, did I really help you answer you question?

If not and you are going to ask a new question, I suggest we just delete this one.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Oracle Database

From novice to tech pro — start learning today.