Avatar of sam2929
sam2929

asked on 

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
Oracle Database

Avatar of undefined
Last Comment
slightwv (䄆 Netminder)
ASKER CERTIFIED SOLUTION
Avatar of slightwv (䄆 Netminder)
slightwv (䄆 Netminder)

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of sam2929
sam2929

ASKER

My bad question don't make sense
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?
>>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.
Oracle Database
Oracle Database

Oracle is an object-relational database management system. It supports a large number of languages and application development frameworks. Its primary languages are SQL, PL/SQL and Java, but it also includes support for C and C++. Oracle also has its own enterprise modules and application server software.

81K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo