Home » SQL & PL/SQL » SQL & PL/SQL » Logic trouble
Logic trouble [message #314445] Wed, 16 April 2008 13:30 Go to next message
Messages: 1
Registered: April 2008
Location: Newfoundland
Junior Member
Hi there,

I have the query below but the case logic isn't working properly.
Table info:
The view being used (CSS_TERM_GROUP_MOBILE_ID_MV) shows mobiles that are in a Terminal Group. These mobiles can be active or inactive.
The mobile_history table contains all of the mobiles(active or not) in a group or not but doesn't contain any info on the groups.

For example, there is a mobile in CSS_TERM_GROUP_MOBILE_ID_MV that is showing as not active (it has been end dated (is not null)), but in the mobile_history, it has an active status and it is actually active, but since it had been newly activated, it is no longer in the terminal group. How can i change my case logic or add conditions in my where clause that can indicate that this mobile and others like it in the list are active but are not in a terminal group?(My actual list has hundreds of mobiles)

SELECT imn AS Mobile,
mh.customer_code AS Customer,
terminal_group_code AS GroupCode,
wHEN v.end_date is null THEN 'Yes'
END ) active

mobile_history mh,
mobile m,
tcustomr c

WHERE IMN IN ('463662340','463701040','463701532','463792331','463663170',

AND v.imn=m.mobile_id
AND m.mobile_id=mh.mobile_id

For the person who can answer this,

Thanks a million!!!!
Re: Logic trouble [message #314475 is a reply to message #314445] Wed, 16 April 2008 18:25 Go to previous message
Barbara Boehmer
Messages: 8608
Registered: November 2002
Location: California, USA
Senior Member
Please read the forum guidelines:


then either edit your post or post a reply to it with the missing information, such as Oracle version, create table and insert statements for sample data, your query formatted using indentation and code tags, the results that your query produces from that data, and the results that you want from that data.

Previous Topic: row_id wrong type in trigger
Next Topic: Determining dates on which events (some overlapping) did not occur
Goto Forum:

Current Time: Fri Oct 21 04:56:04 CDT 2016

Total time taken to generate the page: 0.10808 seconds